Socket
Socket
Sign inDemoInstall

@pixi/canvas-renderer

Package Overview
Dependencies
29
Maintainers
3
Versions
122
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 6.4.2 to 6.5.0-rc

88

dist/browser/canvas-renderer.js
/*!
* @pixi/canvas-renderer - v6.4.2
* Compiled Thu, 02 Jun 2022 15:39:26 UTC
* @pixi/canvas-renderer - v6.5.0-rc
* Compiled Thu, 14 Jul 2022 18:30:46 UTC
*

@@ -13,14 +13,14 @@ * @pixi/canvas-renderer is licensed under the 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
Copyright (c) Microsoft Corporation.
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.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */

@@ -60,4 +60,6 @@ /* global Reflect, Promise */

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]]; } } }
{ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
{ t[p[i]] = s[p[i]]; }
} }
return t;

@@ -82,6 +84,7 @@ }

function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
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); }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());

@@ -119,10 +122,15 @@ });

function __createBinding(o, m, k, k2) {
if (k2 === undefined) { k2 = k; }
o[k2] = m[k];
}
function __exportStar(m, exports) {
for (var p in m) { if (!exports.hasOwnProperty(p)) { exports[p] = m[p]; } }
for (var p in m) { if (p !== "default" && !exports.hasOwnProperty(p)) { exports[p] = m[p]; } }
}
function __values(o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) { return m.call(o); }
return {
if (o && typeof o.length === "number") { return {
next: function () {

@@ -132,3 +140,4 @@ if (o && i >= o.length) { o = void 0; }

}
};
}; }
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
}

@@ -161,2 +170,12 @@

function __spreadArrays() {
var arguments$1 = arguments;
for (var s = 0, i = 0, il = arguments.length; i < il; i++) { s += arguments$1[i].length; }
for (var r = Array(s), k = 0, i = 0; i < il; i++)
{ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
{ r[k] = a[j]; } }
return r;
};
function __await(v) {

@@ -209,2 +228,17 @@ return this instanceof __await ? (this.v = v, this) : new __await(v);

function __classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
}
return privateMap.get(receiver);
}
function __classPrivateFieldSet(receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
privateMap.set(receiver, value);
return value;
}
/**

@@ -446,2 +480,3 @@ * A set of functions used to handle masking.

*/
// TODO after upgrading to typeScript 4.6, replace `string[]` with `GlobalCompositeOperation[]`
function mapCanvasBlendModesToPixi(array) {

@@ -464,3 +499,3 @@ if (array === void 0) { array = []; }

array[constants.BLEND_MODES.HUE] = 'hue';
array[constants.BLEND_MODES.SATURATION] = 'saturate';
array[constants.BLEND_MODES.SATURATION] = 'saturation';
array[constants.BLEND_MODES.COLOR] = 'color';

@@ -782,3 +817,4 @@ array[constants.BLEND_MODES.LUMINOSITY] = 'luminosity';

/**
* Adds a plugin to the renderer.
* Use the {@link PIXI.extensions.add} API to register plugins.
* @deprecated since 6.5.0
* @param pluginName - The name of the plugin.

@@ -788,7 +824,13 @@ * @param ctor - The constructor function or class for the plugin.

CanvasRenderer.registerPlugin = function (pluginName, ctor) {
CanvasRenderer.__plugins = CanvasRenderer.__plugins || {};
CanvasRenderer.__plugins[pluginName] = ctor;
utils.deprecation('6.5.0', 'CanvasRenderer.registerPlugin() has been deprecated, please use extensions.add() instead.');
core.extensions.add({
name: pluginName,
type: core.ExtensionType.CanvasRendererPlugin,
ref: ctor,
});
};
CanvasRenderer.__plugins = {};
return CanvasRenderer;
}(core.AbstractRenderer));
core.extensions.handleByMap(core.ExtensionType.CanvasRendererPlugin, CanvasRenderer.__plugins);

@@ -795,0 +837,0 @@ /**

/*!
* @pixi/canvas-renderer - v6.4.2
* Compiled Thu, 02 Jun 2022 15:39:26 UTC
* @pixi/canvas-renderer - v6.5.0-rc
* Compiled Thu, 14 Jul 2022 18:30:46 UTC
*

@@ -8,3 +8,3 @@ * @pixi/canvas-renderer is licensed under the MIT License.

*/
this.PIXI=this.PIXI||{};var _pixi_canvas_renderer=function(e,t,r,o,n,i){"use strict";var a=function(e,t){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},a(e,t)};var s=function(){function e(e){this._foundShapes=[],this.renderer=e}return e.prototype.pushMask=function(e){var t=this.renderer,r=e.maskObject||e;t.context.save();var o=this._foundShapes;if(this.recursiveFindShapes(r,o),o.length>0){var n=t.context;n.beginPath();for(var i=0;i<o.length;i++){var a=o[i],s=a.transform.worldTransform;this.renderer.setContextTransform(s),this.renderGraphicsShape(a)}o.length=0,n.clip()}},e.prototype.recursiveFindShapes=function(e,t){e.geometry&&e.geometry.graphicsData&&t.push(e);var r=e.children;if(r)for(var o=0;o<r.length;o++)this.recursiveFindShapes(r[o],t)},e.prototype.renderGraphicsShape=function(e){e.finishPoly();var t=this.renderer.context,r=e.geometry.graphicsData,n=r.length;if(0!==n)for(var i=0;i<n;i++){var a=r[i],s=a.shape;if(s.type===o.SHAPES.POLY){var h=s.points,l=a.holes,c=void 0,d=void 0,u=void 0,E=void 0;t.moveTo(h[0],h[1]);for(var p=1;p<h.length/2;p++)t.lineTo(h[2*p],h[2*p+1]);if(l.length>0){c=0,u=h[0],E=h[1];for(p=2;p+2<h.length;p+=2)c+=(h[p]-u)*(h[p+3]-E)-(h[p+2]-u)*(h[p+1]-E);for(var g=0;g<l.length;g++)if(h=l[g].shape.points){d=0,u=h[0],E=h[1];for(p=2;p+2<h.length;p+=2)d+=(h[p]-u)*(h[p+3]-E)-(h[p+2]-u)*(h[p+1]-E);if(d*c<0){t.moveTo(h[0],h[1]);for(p=2;p<h.length;p+=2)t.lineTo(h[p],h[p+1])}else{t.moveTo(h[h.length-2],h[h.length-1]);for(p=h.length-4;p>=0;p-=2)t.lineTo(h[p],h[p+1])}l[g].shape.closeStroke&&t.closePath()}}h[0]===h[h.length-2]&&h[1]===h[h.length-1]&&t.closePath()}else if(s.type===o.SHAPES.RECT)t.rect(s.x,s.y,s.width,s.height),t.closePath();else if(s.type===o.SHAPES.CIRC)t.arc(s.x,s.y,s.radius,0,2*Math.PI),t.closePath();else if(s.type===o.SHAPES.ELIP){var D=2*s.width,v=2*s.height,_=s.x-D/2,S=s.y-v/2,f=.5522848,O=D/2*f,M=v/2*f,m=_+D,T=S+v,C=_+D/2,N=S+v/2;t.moveTo(_,N),t.bezierCurveTo(_,N-M,C-O,S,C,S),t.bezierCurveTo(C+O,S,m,N-M,m,N),t.bezierCurveTo(m,N+M,C+O,T,C,T),t.bezierCurveTo(C-O,T,_,N+M,_,N),t.closePath()}else if(s.type===o.SHAPES.RREC){var L=s.x,y=s.y,x=s.width,B=s.height,R=s.radius,I=Math.min(x,B)/2;R=R>I?I:R,t.moveTo(L,y+R),t.lineTo(L,y+B-R),t.quadraticCurveTo(L,y+B,L+R,y+B),t.lineTo(L+x-R,y+B),t.quadraticCurveTo(L+x,y+B,L+x,y+B-R),t.lineTo(L+x,y+R),t.quadraticCurveTo(L+x,y,L+x-R,y),t.lineTo(L+R,y),t.quadraticCurveTo(L,y,L,y+R),t.closePath()}}},e.prototype.popMask=function(e){e.context.restore(),e.invalidateBlendMode()},e.prototype.destroy=function(){},e}();function h(e){var t=document.createElement("canvas");t.width=6,t.height=1;var r=t.getContext("2d");return r.fillStyle=e,r.fillRect(0,0,6,1),t}function l(){if("undefined"==typeof document)return!1;var e=h("#ff00ff"),t=h("#ffff00"),r=document.createElement("canvas");r.width=6,r.height=1;var o=r.getContext("2d");o.globalCompositeOperation="multiply",o.drawImage(e,0,0),o.drawImage(t,2,0);var n=o.getImageData(2,0,1,1);if(!n)return!1;var i=n.data;return 255===i[0]&&0===i[1]&&0===i[2]}var c=new o.Matrix,d=function(e){function o(t){var i,a=e.call(this,n.RENDERER_TYPE.CANVAS,t)||this;if(a.refresh=!0,a.maskManager=new s(a),a.smoothProperty="imageSmoothingEnabled",a.blendModes=(void 0===i&&(i=[]),l()?(i[n.BLEND_MODES.NORMAL]="source-over",i[n.BLEND_MODES.ADD]="lighter",i[n.BLEND_MODES.MULTIPLY]="multiply",i[n.BLEND_MODES.SCREEN]="screen",i[n.BLEND_MODES.OVERLAY]="overlay",i[n.BLEND_MODES.DARKEN]="darken",i[n.BLEND_MODES.LIGHTEN]="lighten",i[n.BLEND_MODES.COLOR_DODGE]="color-dodge",i[n.BLEND_MODES.COLOR_BURN]="color-burn",i[n.BLEND_MODES.HARD_LIGHT]="hard-light",i[n.BLEND_MODES.SOFT_LIGHT]="soft-light",i[n.BLEND_MODES.DIFFERENCE]="difference",i[n.BLEND_MODES.EXCLUSION]="exclusion",i[n.BLEND_MODES.HUE]="hue",i[n.BLEND_MODES.SATURATION]="saturate",i[n.BLEND_MODES.COLOR]="color",i[n.BLEND_MODES.LUMINOSITY]="luminosity"):(i[n.BLEND_MODES.NORMAL]="source-over",i[n.BLEND_MODES.ADD]="lighter",i[n.BLEND_MODES.MULTIPLY]="source-over",i[n.BLEND_MODES.SCREEN]="source-over",i[n.BLEND_MODES.OVERLAY]="source-over",i[n.BLEND_MODES.DARKEN]="source-over",i[n.BLEND_MODES.LIGHTEN]="source-over",i[n.BLEND_MODES.COLOR_DODGE]="source-over",i[n.BLEND_MODES.COLOR_BURN]="source-over",i[n.BLEND_MODES.HARD_LIGHT]="source-over",i[n.BLEND_MODES.SOFT_LIGHT]="source-over",i[n.BLEND_MODES.DIFFERENCE]="source-over",i[n.BLEND_MODES.EXCLUSION]="source-over",i[n.BLEND_MODES.HUE]="source-over",i[n.BLEND_MODES.SATURATION]="source-over",i[n.BLEND_MODES.COLOR]="source-over",i[n.BLEND_MODES.LUMINOSITY]="source-over"),i[n.BLEND_MODES.NORMAL_NPM]=i[n.BLEND_MODES.NORMAL],i[n.BLEND_MODES.ADD_NPM]=i[n.BLEND_MODES.ADD],i[n.BLEND_MODES.SCREEN_NPM]=i[n.BLEND_MODES.SCREEN],i[n.BLEND_MODES.SRC_IN]="source-in",i[n.BLEND_MODES.SRC_OUT]="source-out",i[n.BLEND_MODES.SRC_ATOP]="source-atop",i[n.BLEND_MODES.DST_OVER]="destination-over",i[n.BLEND_MODES.DST_IN]="destination-in",i[n.BLEND_MODES.DST_OUT]="destination-out",i[n.BLEND_MODES.DST_ATOP]="destination-atop",i[n.BLEND_MODES.XOR]="xor",i[n.BLEND_MODES.SUBTRACT]="source-over",i),a.renderingToScreen=!1,a._activeBlendMode=null,a._projTransform=null,a._outerBlend=!1,a.rootContext=a.view.getContext("2d",{alpha:a.useContextAlpha}),a.context=a.rootContext,!a.rootContext.imageSmoothingEnabled){var h=a.rootContext;h.webkitImageSmoothingEnabled?a.smoothProperty="webkitImageSmoothingEnabled":h.mozImageSmoothingEnabled?a.smoothProperty="mozImageSmoothingEnabled":h.oImageSmoothingEnabled?a.smoothProperty="oImageSmoothingEnabled":h.msImageSmoothingEnabled&&(a.smoothProperty="msImageSmoothingEnabled")}return a.initPlugins(o.__plugins),r.sayHello("Canvas"),a.resize(a.options.width,a.options.height),a}return function(e,t){function r(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(o,e),o.prototype.addSystem=function(){return this},o.prototype.render=function(e,o){if(this.view){var i,a,s,h;o&&(o instanceof t.RenderTexture||o instanceof t.BaseRenderTexture?(i=o,a=arguments[2],s=arguments[3],h=arguments[4]):(i=o.renderTexture,a=o.clear,s=o.transform,h=o.skipUpdateTransform)),this.renderingToScreen=!i,this.emit("prerender");var l=this.resolution;i?((i=i.castToBaseTexture())._canvasRenderTarget||(i._canvasRenderTarget=new r.CanvasRenderTarget(i.width,i.height,i.resolution),i.resource=new t.CanvasResource(i._canvasRenderTarget.canvas),i.valid=!0),this.context=i._canvasRenderTarget.context,this.resolution=i._canvasRenderTarget.resolution):this.context=this.rootContext;var c=this.context;if(this._projTransform=s||null,i||(this._lastObjectRendered=e),!h){var d=e.enableTempParent();e.updateTransform(),e.disableTempParent(d)}if(c.save(),c.setTransform(1,0,0,1,0,0),c.globalAlpha=1,this._activeBlendMode=n.BLEND_MODES.NORMAL,this._outerBlend=!1,c.globalCompositeOperation=this.blendModes[n.BLEND_MODES.NORMAL],void 0!==a?a:this.clearBeforeRender)if(this.renderingToScreen)c.clearRect(0,0,this.width,this.height),this.backgroundAlpha>0&&(c.globalAlpha=this.useContextAlpha?this.backgroundAlpha:1,c.fillStyle=this._backgroundColorString,c.fillRect(0,0,this.width,this.height),c.globalAlpha=1);else{(i=i)._canvasRenderTarget.clear();var u=i.clearColor;u[3]>0&&(c.globalAlpha=this.useContextAlpha?u[3]:1,c.fillStyle=r.hex2string(r.rgb2hex(u)),c.fillRect(0,0,i.realWidth,i.realHeight),c.globalAlpha=1)}var E=this.context;this.context=c,e.renderCanvas(this),this.context=E,c.restore(),this.resolution=l,this._projTransform=null,this.emit("postrender")}},o.prototype.setContextTransform=function(e,t,r){var o=e,n=this._projTransform,i=this.resolution;r=r||i,n&&((o=c).copyFrom(e),o.prepend(n)),t?this.context.setTransform(o.a*r,o.b*r,o.c*r,o.d*r,o.tx*i|0,o.ty*i|0):this.context.setTransform(o.a*r,o.b*r,o.c*r,o.d*r,o.tx*i,o.ty*i)},o.prototype.clear=function(e,t){void 0===e&&(e=this._backgroundColorString),void 0===t&&(t=this.backgroundAlpha);var r=this.context;r.clearRect(0,0,this.width,this.height),e&&(r.globalAlpha=this.useContextAlpha?t:1,r.fillStyle=e,r.fillRect(0,0,this.width,this.height),r.globalAlpha=1)},o.prototype.setBlendMode=function(e,t){var r=e===n.BLEND_MODES.SRC_IN||e===n.BLEND_MODES.SRC_OUT||e===n.BLEND_MODES.DST_IN||e===n.BLEND_MODES.DST_ATOP;!t&&r&&(e=n.BLEND_MODES.NORMAL),this._activeBlendMode!==e&&(this._activeBlendMode=e,this._outerBlend=r,this.context.globalCompositeOperation=this.blendModes[e])},o.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},o.prototype.resize=function(t,r){e.prototype.resize.call(this,t,r),this.smoothProperty&&(this.rootContext[this.smoothProperty]=i.settings.SCALE_MODE===n.SCALE_MODES.LINEAR)},o.prototype.invalidateBlendMode=function(){this._activeBlendMode=this.blendModes.indexOf(this.context.globalCompositeOperation)},o.registerPlugin=function(e,t){o.__plugins=o.__plugins||{},o.__plugins[e]=t},o}(t.AbstractRenderer),u={canvas:null,getTintedCanvas:function(e,t){var r=e.texture,o="#"+("00000"+(0|(t=u.roundColor(t))).toString(16)).slice(-6);r.tintCache=r.tintCache||{};var n,i=r.tintCache[o];if(i){if(i.tintId===r._updateID)return r.tintCache[o];n=r.tintCache[o]}else n=document.createElement("canvas");if(u.tintMethod(r,t,n),n.tintId=r._updateID,u.convertTintToImage){var a=new Image;a.src=n.toDataURL(),r.tintCache[o]=a}else r.tintCache[o]=n;return n},getTintedPattern:function(e,t){var r="#"+("00000"+(0|(t=u.roundColor(t))).toString(16)).slice(-6);e.patternCache=e.patternCache||{};var o=e.patternCache[r];return o&&o.tintId===e._updateID||(u.canvas||(u.canvas=document.createElement("canvas")),u.tintMethod(e,t,u.canvas),(o=u.canvas.getContext("2d").createPattern(u.canvas,"repeat")).tintId=e._updateID,e.patternCache[r]=o),o},tintWithMultiply:function(e,t,r){var o=r.getContext("2d"),n=e._frame.clone(),i=e.baseTexture.resolution;n.x*=i,n.y*=i,n.width*=i,n.height*=i,r.width=Math.ceil(n.width),r.height=Math.ceil(n.height),o.save(),o.fillStyle="#"+("00000"+(0|t).toString(16)).slice(-6),o.fillRect(0,0,n.width,n.height),o.globalCompositeOperation="multiply";var a=e.baseTexture.getDrawableSource();o.drawImage(a,n.x,n.y,n.width,n.height,0,0,n.width,n.height),o.globalCompositeOperation="destination-atop",o.drawImage(a,n.x,n.y,n.width,n.height,0,0,n.width,n.height),o.restore()},tintWithOverlay:function(e,t,r){var o=r.getContext("2d"),n=e._frame.clone(),i=e.baseTexture.resolution;n.x*=i,n.y*=i,n.width*=i,n.height*=i,r.width=Math.ceil(n.width),r.height=Math.ceil(n.height),o.save(),o.globalCompositeOperation="copy",o.fillStyle="#"+("00000"+(0|t).toString(16)).slice(-6),o.fillRect(0,0,n.width,n.height),o.globalCompositeOperation="destination-atop",o.drawImage(e.baseTexture.getDrawableSource(),n.x,n.y,n.width,n.height,0,0,n.width,n.height),o.restore()},tintWithPerPixel:function(e,t,o){var n=o.getContext("2d"),i=e._frame.clone(),a=e.baseTexture.resolution;i.x*=a,i.y*=a,i.width*=a,i.height*=a,o.width=Math.ceil(i.width),o.height=Math.ceil(i.height),n.save(),n.globalCompositeOperation="copy",n.drawImage(e.baseTexture.getDrawableSource(),i.x,i.y,i.width,i.height,0,0,i.width,i.height),n.restore();for(var s=r.hex2rgb(t),h=s[0],l=s[1],c=s[2],d=n.getImageData(0,0,i.width,i.height),u=d.data,E=0;E<u.length;E+=4)u[E+0]*=h,u[E+1]*=l,u[E+2]*=c;n.putImageData(d,0,0)},roundColor:function(e){var t=u.cacheStepsPerColorChannel,o=r.hex2rgb(e);return o[0]=Math.min(255,o[0]/t*t),o[1]=Math.min(255,o[1]/t*t),o[2]=Math.min(255,o[2]/t*t),r.rgb2hex(o)},cacheStepsPerColorChannel:8,convertTintToImage:!1,canUseMultiply:l(),tintMethod:null};u.tintMethod=u.canUseMultiply?u.tintWithMultiply:u.tintWithPerPixel;var E=t.Renderer.create;return t.Renderer.create=function(e){if(!(e&&e.forceCanvas))try{return E(e)}catch(e){}return new d(e)},t.BaseTexture.prototype.getDrawableSource=function(){var e=this.resource;return e?e.bitmap||e.source:null},t.BaseRenderTexture.prototype._canvasRenderTarget=null,t.Texture.prototype.patternCache=null,t.Texture.prototype.tintCache=null,e.CanvasRenderer=d,e.canUseNewCanvasBlendModes=l,e.canvasUtils=u,Object.defineProperty(e,"__esModule",{value:!0}),e}({},PIXI,PIXI.utils,PIXI,PIXI,PIXI);Object.assign(this.PIXI,_pixi_canvas_renderer);
this.PIXI=this.PIXI||{};var _pixi_canvas_renderer=function(e,t,r,o,n,i){"use strict";var a=function(e,t){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},a(e,t)};var s=function(){function e(e){this._foundShapes=[],this.renderer=e}return e.prototype.pushMask=function(e){var t=this.renderer,r=e.maskObject||e;t.context.save();var o=this._foundShapes;if(this.recursiveFindShapes(r,o),o.length>0){var n=t.context;n.beginPath();for(var i=0;i<o.length;i++){var a=o[i],s=a.transform.worldTransform;this.renderer.setContextTransform(s),this.renderGraphicsShape(a)}o.length=0,n.clip()}},e.prototype.recursiveFindShapes=function(e,t){e.geometry&&e.geometry.graphicsData&&t.push(e);var r=e.children;if(r)for(var o=0;o<r.length;o++)this.recursiveFindShapes(r[o],t)},e.prototype.renderGraphicsShape=function(e){e.finishPoly();var t=this.renderer.context,r=e.geometry.graphicsData,n=r.length;if(0!==n)for(var i=0;i<n;i++){var a=r[i],s=a.shape;if(s.type===o.SHAPES.POLY){var h=s.points,l=a.holes,c=void 0,d=void 0,u=void 0,E=void 0;t.moveTo(h[0],h[1]);for(var p=1;p<h.length/2;p++)t.lineTo(h[2*p],h[2*p+1]);if(l.length>0){c=0,u=h[0],E=h[1];for(p=2;p+2<h.length;p+=2)c+=(h[p]-u)*(h[p+3]-E)-(h[p+2]-u)*(h[p+1]-E);for(var g=0;g<l.length;g++)if(h=l[g].shape.points){d=0,u=h[0],E=h[1];for(p=2;p+2<h.length;p+=2)d+=(h[p]-u)*(h[p+3]-E)-(h[p+2]-u)*(h[p+1]-E);if(d*c<0){t.moveTo(h[0],h[1]);for(p=2;p<h.length;p+=2)t.lineTo(h[p],h[p+1])}else{t.moveTo(h[h.length-2],h[h.length-1]);for(p=h.length-4;p>=0;p-=2)t.lineTo(h[p],h[p+1])}l[g].shape.closeStroke&&t.closePath()}}h[0]===h[h.length-2]&&h[1]===h[h.length-1]&&t.closePath()}else if(s.type===o.SHAPES.RECT)t.rect(s.x,s.y,s.width,s.height),t.closePath();else if(s.type===o.SHAPES.CIRC)t.arc(s.x,s.y,s.radius,0,2*Math.PI),t.closePath();else if(s.type===o.SHAPES.ELIP){var D=2*s.width,v=2*s.height,S=s.x-D/2,_=s.y-v/2,f=.5522848,O=D/2*f,M=v/2*f,m=S+D,T=_+v,C=S+D/2,N=_+v/2;t.moveTo(S,N),t.bezierCurveTo(S,N-M,C-O,_,C,_),t.bezierCurveTo(C+O,_,m,N-M,m,N),t.bezierCurveTo(m,N+M,C+O,T,C,T),t.bezierCurveTo(C-O,T,S,N+M,S,N),t.closePath()}else if(s.type===o.SHAPES.RREC){var L=s.x,y=s.y,x=s.width,B=s.height,R=s.radius,I=Math.min(x,B)/2;R=R>I?I:R,t.moveTo(L,y+R),t.lineTo(L,y+B-R),t.quadraticCurveTo(L,y+B,L+R,y+B),t.lineTo(L+x-R,y+B),t.quadraticCurveTo(L+x,y+B,L+x,y+B-R),t.lineTo(L+x,y+R),t.quadraticCurveTo(L+x,y,L+x-R,y),t.lineTo(L+R,y),t.quadraticCurveTo(L,y,L,y+R),t.closePath()}}},e.prototype.popMask=function(e){e.context.restore(),e.invalidateBlendMode()},e.prototype.destroy=function(){},e}();function h(e){var t=document.createElement("canvas");t.width=6,t.height=1;var r=t.getContext("2d");return r.fillStyle=e,r.fillRect(0,0,6,1),t}function l(){if("undefined"==typeof document)return!1;var e=h("#ff00ff"),t=h("#ffff00"),r=document.createElement("canvas");r.width=6,r.height=1;var o=r.getContext("2d");o.globalCompositeOperation="multiply",o.drawImage(e,0,0),o.drawImage(t,2,0);var n=o.getImageData(2,0,1,1);if(!n)return!1;var i=n.data;return 255===i[0]&&0===i[1]&&0===i[2]}var c=new o.Matrix,d=function(e){function o(t){var i,a=e.call(this,n.RENDERER_TYPE.CANVAS,t)||this;if(a.refresh=!0,a.maskManager=new s(a),a.smoothProperty="imageSmoothingEnabled",a.blendModes=(void 0===i&&(i=[]),l()?(i[n.BLEND_MODES.NORMAL]="source-over",i[n.BLEND_MODES.ADD]="lighter",i[n.BLEND_MODES.MULTIPLY]="multiply",i[n.BLEND_MODES.SCREEN]="screen",i[n.BLEND_MODES.OVERLAY]="overlay",i[n.BLEND_MODES.DARKEN]="darken",i[n.BLEND_MODES.LIGHTEN]="lighten",i[n.BLEND_MODES.COLOR_DODGE]="color-dodge",i[n.BLEND_MODES.COLOR_BURN]="color-burn",i[n.BLEND_MODES.HARD_LIGHT]="hard-light",i[n.BLEND_MODES.SOFT_LIGHT]="soft-light",i[n.BLEND_MODES.DIFFERENCE]="difference",i[n.BLEND_MODES.EXCLUSION]="exclusion",i[n.BLEND_MODES.HUE]="hue",i[n.BLEND_MODES.SATURATION]="saturation",i[n.BLEND_MODES.COLOR]="color",i[n.BLEND_MODES.LUMINOSITY]="luminosity"):(i[n.BLEND_MODES.NORMAL]="source-over",i[n.BLEND_MODES.ADD]="lighter",i[n.BLEND_MODES.MULTIPLY]="source-over",i[n.BLEND_MODES.SCREEN]="source-over",i[n.BLEND_MODES.OVERLAY]="source-over",i[n.BLEND_MODES.DARKEN]="source-over",i[n.BLEND_MODES.LIGHTEN]="source-over",i[n.BLEND_MODES.COLOR_DODGE]="source-over",i[n.BLEND_MODES.COLOR_BURN]="source-over",i[n.BLEND_MODES.HARD_LIGHT]="source-over",i[n.BLEND_MODES.SOFT_LIGHT]="source-over",i[n.BLEND_MODES.DIFFERENCE]="source-over",i[n.BLEND_MODES.EXCLUSION]="source-over",i[n.BLEND_MODES.HUE]="source-over",i[n.BLEND_MODES.SATURATION]="source-over",i[n.BLEND_MODES.COLOR]="source-over",i[n.BLEND_MODES.LUMINOSITY]="source-over"),i[n.BLEND_MODES.NORMAL_NPM]=i[n.BLEND_MODES.NORMAL],i[n.BLEND_MODES.ADD_NPM]=i[n.BLEND_MODES.ADD],i[n.BLEND_MODES.SCREEN_NPM]=i[n.BLEND_MODES.SCREEN],i[n.BLEND_MODES.SRC_IN]="source-in",i[n.BLEND_MODES.SRC_OUT]="source-out",i[n.BLEND_MODES.SRC_ATOP]="source-atop",i[n.BLEND_MODES.DST_OVER]="destination-over",i[n.BLEND_MODES.DST_IN]="destination-in",i[n.BLEND_MODES.DST_OUT]="destination-out",i[n.BLEND_MODES.DST_ATOP]="destination-atop",i[n.BLEND_MODES.XOR]="xor",i[n.BLEND_MODES.SUBTRACT]="source-over",i),a.renderingToScreen=!1,a._activeBlendMode=null,a._projTransform=null,a._outerBlend=!1,a.rootContext=a.view.getContext("2d",{alpha:a.useContextAlpha}),a.context=a.rootContext,!a.rootContext.imageSmoothingEnabled){var h=a.rootContext;h.webkitImageSmoothingEnabled?a.smoothProperty="webkitImageSmoothingEnabled":h.mozImageSmoothingEnabled?a.smoothProperty="mozImageSmoothingEnabled":h.oImageSmoothingEnabled?a.smoothProperty="oImageSmoothingEnabled":h.msImageSmoothingEnabled&&(a.smoothProperty="msImageSmoothingEnabled")}return a.initPlugins(o.__plugins),r.sayHello("Canvas"),a.resize(a.options.width,a.options.height),a}return function(e,t){function r(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(o,e),o.prototype.addSystem=function(){return this},o.prototype.render=function(e,o){if(this.view){var i,a,s,h;o&&(o instanceof t.RenderTexture||o instanceof t.BaseRenderTexture?(i=o,a=arguments[2],s=arguments[3],h=arguments[4]):(i=o.renderTexture,a=o.clear,s=o.transform,h=o.skipUpdateTransform)),this.renderingToScreen=!i,this.emit("prerender");var l=this.resolution;i?((i=i.castToBaseTexture())._canvasRenderTarget||(i._canvasRenderTarget=new r.CanvasRenderTarget(i.width,i.height,i.resolution),i.resource=new t.CanvasResource(i._canvasRenderTarget.canvas),i.valid=!0),this.context=i._canvasRenderTarget.context,this.resolution=i._canvasRenderTarget.resolution):this.context=this.rootContext;var c=this.context;if(this._projTransform=s||null,i||(this._lastObjectRendered=e),!h){var d=e.enableTempParent();e.updateTransform(),e.disableTempParent(d)}if(c.save(),c.setTransform(1,0,0,1,0,0),c.globalAlpha=1,this._activeBlendMode=n.BLEND_MODES.NORMAL,this._outerBlend=!1,c.globalCompositeOperation=this.blendModes[n.BLEND_MODES.NORMAL],void 0!==a?a:this.clearBeforeRender)if(this.renderingToScreen)c.clearRect(0,0,this.width,this.height),this.backgroundAlpha>0&&(c.globalAlpha=this.useContextAlpha?this.backgroundAlpha:1,c.fillStyle=this._backgroundColorString,c.fillRect(0,0,this.width,this.height),c.globalAlpha=1);else{(i=i)._canvasRenderTarget.clear();var u=i.clearColor;u[3]>0&&(c.globalAlpha=this.useContextAlpha?u[3]:1,c.fillStyle=r.hex2string(r.rgb2hex(u)),c.fillRect(0,0,i.realWidth,i.realHeight),c.globalAlpha=1)}var E=this.context;this.context=c,e.renderCanvas(this),this.context=E,c.restore(),this.resolution=l,this._projTransform=null,this.emit("postrender")}},o.prototype.setContextTransform=function(e,t,r){var o=e,n=this._projTransform,i=this.resolution;r=r||i,n&&((o=c).copyFrom(e),o.prepend(n)),t?this.context.setTransform(o.a*r,o.b*r,o.c*r,o.d*r,o.tx*i|0,o.ty*i|0):this.context.setTransform(o.a*r,o.b*r,o.c*r,o.d*r,o.tx*i,o.ty*i)},o.prototype.clear=function(e,t){void 0===e&&(e=this._backgroundColorString),void 0===t&&(t=this.backgroundAlpha);var r=this.context;r.clearRect(0,0,this.width,this.height),e&&(r.globalAlpha=this.useContextAlpha?t:1,r.fillStyle=e,r.fillRect(0,0,this.width,this.height),r.globalAlpha=1)},o.prototype.setBlendMode=function(e,t){var r=e===n.BLEND_MODES.SRC_IN||e===n.BLEND_MODES.SRC_OUT||e===n.BLEND_MODES.DST_IN||e===n.BLEND_MODES.DST_ATOP;!t&&r&&(e=n.BLEND_MODES.NORMAL),this._activeBlendMode!==e&&(this._activeBlendMode=e,this._outerBlend=r,this.context.globalCompositeOperation=this.blendModes[e])},o.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},o.prototype.resize=function(t,r){e.prototype.resize.call(this,t,r),this.smoothProperty&&(this.rootContext[this.smoothProperty]=i.settings.SCALE_MODE===n.SCALE_MODES.LINEAR)},o.prototype.invalidateBlendMode=function(){this._activeBlendMode=this.blendModes.indexOf(this.context.globalCompositeOperation)},o.registerPlugin=function(e,r){t.extensions.add({name:e,type:t.ExtensionType.CanvasRendererPlugin,ref:r})},o.__plugins={},o}(t.AbstractRenderer);t.extensions.handleByMap(t.ExtensionType.CanvasRendererPlugin,d.__plugins);var u={canvas:null,getTintedCanvas:function(e,t){var r=e.texture,o="#"+("00000"+(0|(t=u.roundColor(t))).toString(16)).slice(-6);r.tintCache=r.tintCache||{};var n,i=r.tintCache[o];if(i){if(i.tintId===r._updateID)return r.tintCache[o];n=r.tintCache[o]}else n=document.createElement("canvas");if(u.tintMethod(r,t,n),n.tintId=r._updateID,u.convertTintToImage){var a=new Image;a.src=n.toDataURL(),r.tintCache[o]=a}else r.tintCache[o]=n;return n},getTintedPattern:function(e,t){var r="#"+("00000"+(0|(t=u.roundColor(t))).toString(16)).slice(-6);e.patternCache=e.patternCache||{};var o=e.patternCache[r];return o&&o.tintId===e._updateID||(u.canvas||(u.canvas=document.createElement("canvas")),u.tintMethod(e,t,u.canvas),(o=u.canvas.getContext("2d").createPattern(u.canvas,"repeat")).tintId=e._updateID,e.patternCache[r]=o),o},tintWithMultiply:function(e,t,r){var o=r.getContext("2d"),n=e._frame.clone(),i=e.baseTexture.resolution;n.x*=i,n.y*=i,n.width*=i,n.height*=i,r.width=Math.ceil(n.width),r.height=Math.ceil(n.height),o.save(),o.fillStyle="#"+("00000"+(0|t).toString(16)).slice(-6),o.fillRect(0,0,n.width,n.height),o.globalCompositeOperation="multiply";var a=e.baseTexture.getDrawableSource();o.drawImage(a,n.x,n.y,n.width,n.height,0,0,n.width,n.height),o.globalCompositeOperation="destination-atop",o.drawImage(a,n.x,n.y,n.width,n.height,0,0,n.width,n.height),o.restore()},tintWithOverlay:function(e,t,r){var o=r.getContext("2d"),n=e._frame.clone(),i=e.baseTexture.resolution;n.x*=i,n.y*=i,n.width*=i,n.height*=i,r.width=Math.ceil(n.width),r.height=Math.ceil(n.height),o.save(),o.globalCompositeOperation="copy",o.fillStyle="#"+("00000"+(0|t).toString(16)).slice(-6),o.fillRect(0,0,n.width,n.height),o.globalCompositeOperation="destination-atop",o.drawImage(e.baseTexture.getDrawableSource(),n.x,n.y,n.width,n.height,0,0,n.width,n.height),o.restore()},tintWithPerPixel:function(e,t,o){var n=o.getContext("2d"),i=e._frame.clone(),a=e.baseTexture.resolution;i.x*=a,i.y*=a,i.width*=a,i.height*=a,o.width=Math.ceil(i.width),o.height=Math.ceil(i.height),n.save(),n.globalCompositeOperation="copy",n.drawImage(e.baseTexture.getDrawableSource(),i.x,i.y,i.width,i.height,0,0,i.width,i.height),n.restore();for(var s=r.hex2rgb(t),h=s[0],l=s[1],c=s[2],d=n.getImageData(0,0,i.width,i.height),u=d.data,E=0;E<u.length;E+=4)u[E+0]*=h,u[E+1]*=l,u[E+2]*=c;n.putImageData(d,0,0)},roundColor:function(e){var t=u.cacheStepsPerColorChannel,o=r.hex2rgb(e);return o[0]=Math.min(255,o[0]/t*t),o[1]=Math.min(255,o[1]/t*t),o[2]=Math.min(255,o[2]/t*t),r.rgb2hex(o)},cacheStepsPerColorChannel:8,convertTintToImage:!1,canUseMultiply:l(),tintMethod:null};u.tintMethod=u.canUseMultiply?u.tintWithMultiply:u.tintWithPerPixel;var E=t.Renderer.create;return t.Renderer.create=function(e){if(!(e&&e.forceCanvas))try{return E(e)}catch(e){}return new d(e)},t.BaseTexture.prototype.getDrawableSource=function(){var e=this.resource;return e?e.bitmap||e.source:null},t.BaseRenderTexture.prototype._canvasRenderTarget=null,t.Texture.prototype.patternCache=null,t.Texture.prototype.tintCache=null,e.CanvasRenderer=d,e.canUseNewCanvasBlendModes=l,e.canvasUtils=u,Object.defineProperty(e,"__esModule",{value:!0}),e}({},PIXI,PIXI.utils,PIXI,PIXI,PIXI);Object.assign(this.PIXI,_pixi_canvas_renderer);
//# sourceMappingURL=canvas-renderer.min.js.map
/*!
* @pixi/canvas-renderer - v6.4.2
* Compiled Thu, 02 Jun 2022 15:39:26 UTC
* @pixi/canvas-renderer - v6.5.0-rc
* Compiled Thu, 14 Jul 2022 18:30:46 UTC
*

@@ -19,14 +19,14 @@ * @pixi/canvas-renderer is licensed under the 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
Copyright (c) Microsoft Corporation.
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.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */

@@ -284,2 +284,3 @@ /* global Reflect, Promise */

*/
// TODO after upgrading to typeScript 4.6, replace `string[]` with `GlobalCompositeOperation[]`
function mapCanvasBlendModesToPixi(array) {

@@ -302,3 +303,3 @@ if (array === void 0) { array = []; }

array[constants.BLEND_MODES.HUE] = 'hue';
array[constants.BLEND_MODES.SATURATION] = 'saturate';
array[constants.BLEND_MODES.SATURATION] = 'saturation';
array[constants.BLEND_MODES.COLOR] = 'color';

@@ -620,3 +621,4 @@ array[constants.BLEND_MODES.LUMINOSITY] = 'luminosity';

/**
* Adds a plugin to the renderer.
* Use the {@link PIXI.extensions.add} API to register plugins.
* @deprecated since 6.5.0
* @param pluginName - The name of the plugin.

@@ -626,7 +628,13 @@ * @param ctor - The constructor function or class for the plugin.

CanvasRenderer.registerPlugin = function (pluginName, ctor) {
CanvasRenderer.__plugins = CanvasRenderer.__plugins || {};
CanvasRenderer.__plugins[pluginName] = ctor;
utils.deprecation('6.5.0', 'CanvasRenderer.registerPlugin() has been deprecated, please use extensions.add() instead.');
core.extensions.add({
name: pluginName,
type: core.ExtensionType.CanvasRendererPlugin,
ref: ctor,
});
};
CanvasRenderer.__plugins = {};
return CanvasRenderer;
}(core.AbstractRenderer));
core.extensions.handleByMap(core.ExtensionType.CanvasRendererPlugin, CanvasRenderer.__plugins);

@@ -633,0 +641,0 @@ /**

/*!
* @pixi/canvas-renderer - v6.4.2
* Compiled Thu, 02 Jun 2022 15:39:26 UTC
* @pixi/canvas-renderer - v6.5.0-rc
* Compiled Thu, 14 Jul 2022 18:30:46 UTC
*

@@ -8,3 +8,3 @@ * @pixi/canvas-renderer is licensed under the MIT License.

*/
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@pixi/core"),t=require("@pixi/utils"),r=require("@pixi/math"),o=require("@pixi/constants"),i=require("@pixi/settings"),n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},n(e,t)};var a=function(){function e(e){this._foundShapes=[],this.renderer=e}return e.prototype.pushMask=function(e){var t=this.renderer,r=e.maskObject||e;t.context.save();var o=this._foundShapes;if(this.recursiveFindShapes(r,o),o.length>0){var i=t.context;i.beginPath();for(var n=0;n<o.length;n++){var a=o[n],s=a.transform.worldTransform;this.renderer.setContextTransform(s),this.renderGraphicsShape(a)}o.length=0,i.clip()}},e.prototype.recursiveFindShapes=function(e,t){e.geometry&&e.geometry.graphicsData&&t.push(e);var r=e.children;if(r)for(var o=0;o<r.length;o++)this.recursiveFindShapes(r[o],t)},e.prototype.renderGraphicsShape=function(e){e.finishPoly();var t=this.renderer.context,o=e.geometry.graphicsData,i=o.length;if(0!==i)for(var n=0;n<i;n++){var a=o[n],s=a.shape;if(s.type===r.SHAPES.POLY){var h=s.points,l=a.holes,c=void 0,d=void 0,u=void 0,p=void 0;t.moveTo(h[0],h[1]);for(var E=1;E<h.length/2;E++)t.lineTo(h[2*E],h[2*E+1]);if(l.length>0){c=0,u=h[0],p=h[1];for(E=2;E+2<h.length;E+=2)c+=(h[E]-u)*(h[E+3]-p)-(h[E+2]-u)*(h[E+1]-p);for(var g=0;g<l.length;g++)if(h=l[g].shape.points){d=0,u=h[0],p=h[1];for(E=2;E+2<h.length;E+=2)d+=(h[E]-u)*(h[E+3]-p)-(h[E+2]-u)*(h[E+1]-p);if(d*c<0){t.moveTo(h[0],h[1]);for(E=2;E<h.length;E+=2)t.lineTo(h[E],h[E+1])}else{t.moveTo(h[h.length-2],h[h.length-1]);for(E=h.length-4;E>=0;E-=2)t.lineTo(h[E],h[E+1])}l[g].shape.closeStroke&&t.closePath()}}h[0]===h[h.length-2]&&h[1]===h[h.length-1]&&t.closePath()}else if(s.type===r.SHAPES.RECT)t.rect(s.x,s.y,s.width,s.height),t.closePath();else if(s.type===r.SHAPES.CIRC)t.arc(s.x,s.y,s.radius,0,2*Math.PI),t.closePath();else if(s.type===r.SHAPES.ELIP){var D=2*s.width,v=2*s.height,S=s.x-D/2,_=s.y-v/2,f=.5522848,O=D/2*f,M=v/2*f,m=S+D,T=_+v,C=S+D/2,N=_+v/2;t.moveTo(S,N),t.bezierCurveTo(S,N-M,C-O,_,C,_),t.bezierCurveTo(C+O,_,m,N-M,m,N),t.bezierCurveTo(m,N+M,C+O,T,C,T),t.bezierCurveTo(C-O,T,S,N+M,S,N),t.closePath()}else if(s.type===r.SHAPES.RREC){var L=s.x,x=s.y,y=s.width,B=s.height,R=s.radius,b=Math.min(y,B)/2;R=R>b?b:R,t.moveTo(L,x+R),t.lineTo(L,x+B-R),t.quadraticCurveTo(L,x+B,L+R,x+B),t.lineTo(L+y-R,x+B),t.quadraticCurveTo(L+y,x+B,L+y,x+B-R),t.lineTo(L+y,x+R),t.quadraticCurveTo(L+y,x,L+y-R,x),t.lineTo(L+R,x),t.quadraticCurveTo(L,x,L,x+R),t.closePath()}}},e.prototype.popMask=function(e){e.context.restore(),e.invalidateBlendMode()},e.prototype.destroy=function(){},e}();function s(e){var t=document.createElement("canvas");t.width=6,t.height=1;var r=t.getContext("2d");return r.fillStyle=e,r.fillRect(0,0,6,1),t}function h(){if("undefined"==typeof document)return!1;var e=s("#ff00ff"),t=s("#ffff00"),r=document.createElement("canvas");r.width=6,r.height=1;var o=r.getContext("2d");o.globalCompositeOperation="multiply",o.drawImage(e,0,0),o.drawImage(t,2,0);var i=o.getImageData(2,0,1,1);if(!i)return!1;var n=i.data;return 255===n[0]&&0===n[1]&&0===n[2]}var l=new r.Matrix,c=function(r){function s(e){var i,n=r.call(this,o.RENDERER_TYPE.CANVAS,e)||this;if(n.refresh=!0,n.maskManager=new a(n),n.smoothProperty="imageSmoothingEnabled",n.blendModes=(void 0===i&&(i=[]),h()?(i[o.BLEND_MODES.NORMAL]="source-over",i[o.BLEND_MODES.ADD]="lighter",i[o.BLEND_MODES.MULTIPLY]="multiply",i[o.BLEND_MODES.SCREEN]="screen",i[o.BLEND_MODES.OVERLAY]="overlay",i[o.BLEND_MODES.DARKEN]="darken",i[o.BLEND_MODES.LIGHTEN]="lighten",i[o.BLEND_MODES.COLOR_DODGE]="color-dodge",i[o.BLEND_MODES.COLOR_BURN]="color-burn",i[o.BLEND_MODES.HARD_LIGHT]="hard-light",i[o.BLEND_MODES.SOFT_LIGHT]="soft-light",i[o.BLEND_MODES.DIFFERENCE]="difference",i[o.BLEND_MODES.EXCLUSION]="exclusion",i[o.BLEND_MODES.HUE]="hue",i[o.BLEND_MODES.SATURATION]="saturate",i[o.BLEND_MODES.COLOR]="color",i[o.BLEND_MODES.LUMINOSITY]="luminosity"):(i[o.BLEND_MODES.NORMAL]="source-over",i[o.BLEND_MODES.ADD]="lighter",i[o.BLEND_MODES.MULTIPLY]="source-over",i[o.BLEND_MODES.SCREEN]="source-over",i[o.BLEND_MODES.OVERLAY]="source-over",i[o.BLEND_MODES.DARKEN]="source-over",i[o.BLEND_MODES.LIGHTEN]="source-over",i[o.BLEND_MODES.COLOR_DODGE]="source-over",i[o.BLEND_MODES.COLOR_BURN]="source-over",i[o.BLEND_MODES.HARD_LIGHT]="source-over",i[o.BLEND_MODES.SOFT_LIGHT]="source-over",i[o.BLEND_MODES.DIFFERENCE]="source-over",i[o.BLEND_MODES.EXCLUSION]="source-over",i[o.BLEND_MODES.HUE]="source-over",i[o.BLEND_MODES.SATURATION]="source-over",i[o.BLEND_MODES.COLOR]="source-over",i[o.BLEND_MODES.LUMINOSITY]="source-over"),i[o.BLEND_MODES.NORMAL_NPM]=i[o.BLEND_MODES.NORMAL],i[o.BLEND_MODES.ADD_NPM]=i[o.BLEND_MODES.ADD],i[o.BLEND_MODES.SCREEN_NPM]=i[o.BLEND_MODES.SCREEN],i[o.BLEND_MODES.SRC_IN]="source-in",i[o.BLEND_MODES.SRC_OUT]="source-out",i[o.BLEND_MODES.SRC_ATOP]="source-atop",i[o.BLEND_MODES.DST_OVER]="destination-over",i[o.BLEND_MODES.DST_IN]="destination-in",i[o.BLEND_MODES.DST_OUT]="destination-out",i[o.BLEND_MODES.DST_ATOP]="destination-atop",i[o.BLEND_MODES.XOR]="xor",i[o.BLEND_MODES.SUBTRACT]="source-over",i),n.renderingToScreen=!1,n._activeBlendMode=null,n._projTransform=null,n._outerBlend=!1,n.rootContext=n.view.getContext("2d",{alpha:n.useContextAlpha}),n.context=n.rootContext,!n.rootContext.imageSmoothingEnabled){var l=n.rootContext;l.webkitImageSmoothingEnabled?n.smoothProperty="webkitImageSmoothingEnabled":l.mozImageSmoothingEnabled?n.smoothProperty="mozImageSmoothingEnabled":l.oImageSmoothingEnabled?n.smoothProperty="oImageSmoothingEnabled":l.msImageSmoothingEnabled&&(n.smoothProperty="msImageSmoothingEnabled")}return n.initPlugins(s.__plugins),t.sayHello("Canvas"),n.resize(n.options.width,n.options.height),n}return function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(s,r),s.prototype.addSystem=function(){return this},s.prototype.render=function(r,i){if(this.view){var n,a,s,h;i&&(i instanceof e.RenderTexture||i instanceof e.BaseRenderTexture?(n=i,a=arguments[2],s=arguments[3],h=arguments[4]):(n=i.renderTexture,a=i.clear,s=i.transform,h=i.skipUpdateTransform)),this.renderingToScreen=!n,this.emit("prerender");var l=this.resolution;n?((n=n.castToBaseTexture())._canvasRenderTarget||(n._canvasRenderTarget=new t.CanvasRenderTarget(n.width,n.height,n.resolution),n.resource=new e.CanvasResource(n._canvasRenderTarget.canvas),n.valid=!0),this.context=n._canvasRenderTarget.context,this.resolution=n._canvasRenderTarget.resolution):this.context=this.rootContext;var c=this.context;if(this._projTransform=s||null,n||(this._lastObjectRendered=r),!h){var d=r.enableTempParent();r.updateTransform(),r.disableTempParent(d)}if(c.save(),c.setTransform(1,0,0,1,0,0),c.globalAlpha=1,this._activeBlendMode=o.BLEND_MODES.NORMAL,this._outerBlend=!1,c.globalCompositeOperation=this.blendModes[o.BLEND_MODES.NORMAL],void 0!==a?a:this.clearBeforeRender)if(this.renderingToScreen)c.clearRect(0,0,this.width,this.height),this.backgroundAlpha>0&&(c.globalAlpha=this.useContextAlpha?this.backgroundAlpha:1,c.fillStyle=this._backgroundColorString,c.fillRect(0,0,this.width,this.height),c.globalAlpha=1);else{(n=n)._canvasRenderTarget.clear();var u=n.clearColor;u[3]>0&&(c.globalAlpha=this.useContextAlpha?u[3]:1,c.fillStyle=t.hex2string(t.rgb2hex(u)),c.fillRect(0,0,n.realWidth,n.realHeight),c.globalAlpha=1)}var p=this.context;this.context=c,r.renderCanvas(this),this.context=p,c.restore(),this.resolution=l,this._projTransform=null,this.emit("postrender")}},s.prototype.setContextTransform=function(e,t,r){var o=e,i=this._projTransform,n=this.resolution;r=r||n,i&&((o=l).copyFrom(e),o.prepend(i)),t?this.context.setTransform(o.a*r,o.b*r,o.c*r,o.d*r,o.tx*n|0,o.ty*n|0):this.context.setTransform(o.a*r,o.b*r,o.c*r,o.d*r,o.tx*n,o.ty*n)},s.prototype.clear=function(e,t){void 0===e&&(e=this._backgroundColorString),void 0===t&&(t=this.backgroundAlpha);var r=this.context;r.clearRect(0,0,this.width,this.height),e&&(r.globalAlpha=this.useContextAlpha?t:1,r.fillStyle=e,r.fillRect(0,0,this.width,this.height),r.globalAlpha=1)},s.prototype.setBlendMode=function(e,t){var r=e===o.BLEND_MODES.SRC_IN||e===o.BLEND_MODES.SRC_OUT||e===o.BLEND_MODES.DST_IN||e===o.BLEND_MODES.DST_ATOP;!t&&r&&(e=o.BLEND_MODES.NORMAL),this._activeBlendMode!==e&&(this._activeBlendMode=e,this._outerBlend=r,this.context.globalCompositeOperation=this.blendModes[e])},s.prototype.destroy=function(e){r.prototype.destroy.call(this,e),this.context=null,this.refresh=!0,this.maskManager.destroy(),this.maskManager=null,this.smoothProperty=null},s.prototype.resize=function(e,t){r.prototype.resize.call(this,e,t),this.smoothProperty&&(this.rootContext[this.smoothProperty]=i.settings.SCALE_MODE===o.SCALE_MODES.LINEAR)},s.prototype.invalidateBlendMode=function(){this._activeBlendMode=this.blendModes.indexOf(this.context.globalCompositeOperation)},s.registerPlugin=function(e,t){s.__plugins=s.__plugins||{},s.__plugins[e]=t},s}(e.AbstractRenderer),d={canvas:null,getTintedCanvas:function(e,t){var r=e.texture,o="#"+("00000"+(0|(t=d.roundColor(t))).toString(16)).slice(-6);r.tintCache=r.tintCache||{};var i,n=r.tintCache[o];if(n){if(n.tintId===r._updateID)return r.tintCache[o];i=r.tintCache[o]}else i=document.createElement("canvas");if(d.tintMethod(r,t,i),i.tintId=r._updateID,d.convertTintToImage){var a=new Image;a.src=i.toDataURL(),r.tintCache[o]=a}else r.tintCache[o]=i;return i},getTintedPattern:function(e,t){var r="#"+("00000"+(0|(t=d.roundColor(t))).toString(16)).slice(-6);e.patternCache=e.patternCache||{};var o=e.patternCache[r];return o&&o.tintId===e._updateID||(d.canvas||(d.canvas=document.createElement("canvas")),d.tintMethod(e,t,d.canvas),(o=d.canvas.getContext("2d").createPattern(d.canvas,"repeat")).tintId=e._updateID,e.patternCache[r]=o),o},tintWithMultiply:function(e,t,r){var o=r.getContext("2d"),i=e._frame.clone(),n=e.baseTexture.resolution;i.x*=n,i.y*=n,i.width*=n,i.height*=n,r.width=Math.ceil(i.width),r.height=Math.ceil(i.height),o.save(),o.fillStyle="#"+("00000"+(0|t).toString(16)).slice(-6),o.fillRect(0,0,i.width,i.height),o.globalCompositeOperation="multiply";var a=e.baseTexture.getDrawableSource();o.drawImage(a,i.x,i.y,i.width,i.height,0,0,i.width,i.height),o.globalCompositeOperation="destination-atop",o.drawImage(a,i.x,i.y,i.width,i.height,0,0,i.width,i.height),o.restore()},tintWithOverlay:function(e,t,r){var o=r.getContext("2d"),i=e._frame.clone(),n=e.baseTexture.resolution;i.x*=n,i.y*=n,i.width*=n,i.height*=n,r.width=Math.ceil(i.width),r.height=Math.ceil(i.height),o.save(),o.globalCompositeOperation="copy",o.fillStyle="#"+("00000"+(0|t).toString(16)).slice(-6),o.fillRect(0,0,i.width,i.height),o.globalCompositeOperation="destination-atop",o.drawImage(e.baseTexture.getDrawableSource(),i.x,i.y,i.width,i.height,0,0,i.width,i.height),o.restore()},tintWithPerPixel:function(e,r,o){var i=o.getContext("2d"),n=e._frame.clone(),a=e.baseTexture.resolution;n.x*=a,n.y*=a,n.width*=a,n.height*=a,o.width=Math.ceil(n.width),o.height=Math.ceil(n.height),i.save(),i.globalCompositeOperation="copy",i.drawImage(e.baseTexture.getDrawableSource(),n.x,n.y,n.width,n.height,0,0,n.width,n.height),i.restore();for(var s=t.hex2rgb(r),h=s[0],l=s[1],c=s[2],d=i.getImageData(0,0,n.width,n.height),u=d.data,p=0;p<u.length;p+=4)u[p+0]*=h,u[p+1]*=l,u[p+2]*=c;i.putImageData(d,0,0)},roundColor:function(e){var r=d.cacheStepsPerColorChannel,o=t.hex2rgb(e);return o[0]=Math.min(255,o[0]/r*r),o[1]=Math.min(255,o[1]/r*r),o[2]=Math.min(255,o[2]/r*r),t.rgb2hex(o)},cacheStepsPerColorChannel:8,convertTintToImage:!1,canUseMultiply:h(),tintMethod:null};d.tintMethod=d.canUseMultiply?d.tintWithMultiply:d.tintWithPerPixel;var u=e.Renderer.create;e.Renderer.create=function(e){if(!(e&&e.forceCanvas))try{return u(e)}catch(e){}return new c(e)},e.BaseTexture.prototype.getDrawableSource=function(){var e=this.resource;return e?e.bitmap||e.source:null},e.BaseRenderTexture.prototype._canvasRenderTarget=null,e.Texture.prototype.patternCache=null,e.Texture.prototype.tintCache=null,exports.CanvasRenderer=c,exports.canUseNewCanvasBlendModes=h,exports.canvasUtils=d;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@pixi/core"),t=require("@pixi/utils"),r=require("@pixi/math"),o=require("@pixi/constants"),n=require("@pixi/settings"),i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},i(e,t)};var a=function(){function e(e){this._foundShapes=[],this.renderer=e}return e.prototype.pushMask=function(e){var t=this.renderer,r=e.maskObject||e;t.context.save();var o=this._foundShapes;if(this.recursiveFindShapes(r,o),o.length>0){var n=t.context;n.beginPath();for(var i=0;i<o.length;i++){var a=o[i],s=a.transform.worldTransform;this.renderer.setContextTransform(s),this.renderGraphicsShape(a)}o.length=0,n.clip()}},e.prototype.recursiveFindShapes=function(e,t){e.geometry&&e.geometry.graphicsData&&t.push(e);var r=e.children;if(r)for(var o=0;o<r.length;o++)this.recursiveFindShapes(r[o],t)},e.prototype.renderGraphicsShape=function(e){e.finishPoly();var t=this.renderer.context,o=e.geometry.graphicsData,n=o.length;if(0!==n)for(var i=0;i<n;i++){var a=o[i],s=a.shape;if(s.type===r.SHAPES.POLY){var h=s.points,l=a.holes,c=void 0,d=void 0,u=void 0,p=void 0;t.moveTo(h[0],h[1]);for(var E=1;E<h.length/2;E++)t.lineTo(h[2*E],h[2*E+1]);if(l.length>0){c=0,u=h[0],p=h[1];for(E=2;E+2<h.length;E+=2)c+=(h[E]-u)*(h[E+3]-p)-(h[E+2]-u)*(h[E+1]-p);for(var g=0;g<l.length;g++)if(h=l[g].shape.points){d=0,u=h[0],p=h[1];for(E=2;E+2<h.length;E+=2)d+=(h[E]-u)*(h[E+3]-p)-(h[E+2]-u)*(h[E+1]-p);if(d*c<0){t.moveTo(h[0],h[1]);for(E=2;E<h.length;E+=2)t.lineTo(h[E],h[E+1])}else{t.moveTo(h[h.length-2],h[h.length-1]);for(E=h.length-4;E>=0;E-=2)t.lineTo(h[E],h[E+1])}l[g].shape.closeStroke&&t.closePath()}}h[0]===h[h.length-2]&&h[1]===h[h.length-1]&&t.closePath()}else if(s.type===r.SHAPES.RECT)t.rect(s.x,s.y,s.width,s.height),t.closePath();else if(s.type===r.SHAPES.CIRC)t.arc(s.x,s.y,s.radius,0,2*Math.PI),t.closePath();else if(s.type===r.SHAPES.ELIP){var D=2*s.width,v=2*s.height,S=s.x-D/2,_=s.y-v/2,f=.5522848,O=D/2*f,M=v/2*f,m=S+D,T=_+v,C=S+D/2,N=_+v/2;t.moveTo(S,N),t.bezierCurveTo(S,N-M,C-O,_,C,_),t.bezierCurveTo(C+O,_,m,N-M,m,N),t.bezierCurveTo(m,N+M,C+O,T,C,T),t.bezierCurveTo(C-O,T,S,N+M,S,N),t.closePath()}else if(s.type===r.SHAPES.RREC){var L=s.x,x=s.y,y=s.width,B=s.height,R=s.radius,b=Math.min(y,B)/2;R=R>b?b:R,t.moveTo(L,x+R),t.lineTo(L,x+B-R),t.quadraticCurveTo(L,x+B,L+R,x+B),t.lineTo(L+y-R,x+B),t.quadraticCurveTo(L+y,x+B,L+y,x+B-R),t.lineTo(L+y,x+R),t.quadraticCurveTo(L+y,x,L+y-R,x),t.lineTo(L+R,x),t.quadraticCurveTo(L,x,L,x+R),t.closePath()}}},e.prototype.popMask=function(e){e.context.restore(),e.invalidateBlendMode()},e.prototype.destroy=function(){},e}();function s(e){var t=document.createElement("canvas");t.width=6,t.height=1;var r=t.getContext("2d");return r.fillStyle=e,r.fillRect(0,0,6,1),t}function h(){if("undefined"==typeof document)return!1;var e=s("#ff00ff"),t=s("#ffff00"),r=document.createElement("canvas");r.width=6,r.height=1;var o=r.getContext("2d");o.globalCompositeOperation="multiply",o.drawImage(e,0,0),o.drawImage(t,2,0);var n=o.getImageData(2,0,1,1);if(!n)return!1;var i=n.data;return 255===i[0]&&0===i[1]&&0===i[2]}var l=new r.Matrix,c=function(r){function s(e){var n,i=r.call(this,o.RENDERER_TYPE.CANVAS,e)||this;if(i.refresh=!0,i.maskManager=new a(i),i.smoothProperty="imageSmoothingEnabled",i.blendModes=(void 0===n&&(n=[]),h()?(n[o.BLEND_MODES.NORMAL]="source-over",n[o.BLEND_MODES.ADD]="lighter",n[o.BLEND_MODES.MULTIPLY]="multiply",n[o.BLEND_MODES.SCREEN]="screen",n[o.BLEND_MODES.OVERLAY]="overlay",n[o.BLEND_MODES.DARKEN]="darken",n[o.BLEND_MODES.LIGHTEN]="lighten",n[o.BLEND_MODES.COLOR_DODGE]="color-dodge",n[o.BLEND_MODES.COLOR_BURN]="color-burn",n[o.BLEND_MODES.HARD_LIGHT]="hard-light",n[o.BLEND_MODES.SOFT_LIGHT]="soft-light",n[o.BLEND_MODES.DIFFERENCE]="difference",n[o.BLEND_MODES.EXCLUSION]="exclusion",n[o.BLEND_MODES.HUE]="hue",n[o.BLEND_MODES.SATURATION]="saturation",n[o.BLEND_MODES.COLOR]="color",n[o.BLEND_MODES.LUMINOSITY]="luminosity"):(n[o.BLEND_MODES.NORMAL]="source-over",n[o.BLEND_MODES.ADD]="lighter",n[o.BLEND_MODES.MULTIPLY]="source-over",n[o.BLEND_MODES.SCREEN]="source-over",n[o.BLEND_MODES.OVERLAY]="source-over",n[o.BLEND_MODES.DARKEN]="source-over",n[o.BLEND_MODES.LIGHTEN]="source-over",n[o.BLEND_MODES.COLOR_DODGE]="source-over",n[o.BLEND_MODES.COLOR_BURN]="source-over",n[o.BLEND_MODES.HARD_LIGHT]="source-over",n[o.BLEND_MODES.SOFT_LIGHT]="source-over",n[o.BLEND_MODES.DIFFERENCE]="source-over",n[o.BLEND_MODES.EXCLUSION]="source-over",n[o.BLEND_MODES.HUE]="source-over",n[o.BLEND_MODES.SATURATION]="source-over",n[o.BLEND_MODES.COLOR]="source-over",n[o.BLEND_MODES.LUMINOSITY]="source-over"),n[o.BLEND_MODES.NORMAL_NPM]=n[o.BLEND_MODES.NORMAL],n[o.BLEND_MODES.ADD_NPM]=n[o.BLEND_MODES.ADD],n[o.BLEND_MODES.SCREEN_NPM]=n[o.BLEND_MODES.SCREEN],n[o.BLEND_MODES.SRC_IN]="source-in",n[o.BLEND_MODES.SRC_OUT]="source-out",n[o.BLEND_MODES.SRC_ATOP]="source-atop",n[o.BLEND_MODES.DST_OVER]="destination-over",n[o.BLEND_MODES.DST_IN]="destination-in",n[o.BLEND_MODES.DST_OUT]="destination-out",n[o.BLEND_MODES.DST_ATOP]="destination-atop",n[o.BLEND_MODES.XOR]="xor",n[o.BLEND_MODES.SUBTRACT]="source-over",n),i.renderingToScreen=!1,i._activeBlendMode=null,i._projTransform=null,i._outerBlend=!1,i.rootContext=i.view.getContext("2d",{alpha:i.useContextAlpha}),i.context=i.rootContext,!i.rootContext.imageSmoothingEnabled){var l=i.rootContext;l.webkitImageSmoothingEnabled?i.smoothProperty="webkitImageSmoothingEnabled":l.mozImageSmoothingEnabled?i.smoothProperty="mozImageSmoothingEnabled":l.oImageSmoothingEnabled?i.smoothProperty="oImageSmoothingEnabled":l.msImageSmoothingEnabled&&(i.smoothProperty="msImageSmoothingEnabled")}return i.initPlugins(s.__plugins),t.sayHello("Canvas"),i.resize(i.options.width,i.options.height),i}return function(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(s,r),s.prototype.addSystem=function(){return this},s.prototype.render=function(r,n){if(this.view){var i,a,s,h;n&&(n instanceof e.RenderTexture||n instanceof e.BaseRenderTexture?(i=n,a=arguments[2],s=arguments[3],h=arguments[4]):(i=n.renderTexture,a=n.clear,s=n.transform,h=n.skipUpdateTransform)),this.renderingToScreen=!i,this.emit("prerender");var l=this.resolution;i?((i=i.castToBaseTexture())._canvasRenderTarget||(i._canvasRenderTarget=new t.CanvasRenderTarget(i.width,i.height,i.resolution),i.resource=new e.CanvasResource(i._canvasRenderTarget.canvas),i.valid=!0),this.context=i._canvasRenderTarget.context,this.resolution=i._canvasRenderTarget.resolution):this.context=this.rootContext;var c=this.context;if(this._projTransform=s||null,i||(this._lastObjectRendered=r),!h){var d=r.enableTempParent();r.updateTransform(),r.disableTempParent(d)}if(c.save(),c.setTransform(1,0,0,1,0,0),c.globalAlpha=1,this._activeBlendMode=o.BLEND_MODES.NORMAL,this._outerBlend=!1,c.globalCompositeOperation=this.blendModes[o.BLEND_MODES.NORMAL],void 0!==a?a:this.clearBeforeRender)if(this.renderingToScreen)c.clearRect(0,0,this.width,this.height),this.backgroundAlpha>0&&(c.globalAlpha=this.useContextAlpha?this.backgroundAlpha:1,c.fillStyle=this._backgroundColorString,c.fillRect(0,0,this.width,this.height),c.globalAlpha=1);else{(i=i)._canvasRenderTarget.clear();var u=i.clearColor;u[3]>0&&(c.globalAlpha=this.useContextAlpha?u[3]:1,c.fillStyle=t.hex2string(t.rgb2hex(u)),c.fillRect(0,0,i.realWidth,i.realHeight),c.globalAlpha=1)}var p=this.context;this.context=c,r.renderCanvas(this),this.context=p,c.restore(),this.resolution=l,this._projTransform=null,this.emit("postrender")}},s.prototype.setContextTransform=function(e,t,r){var o=e,n=this._projTransform,i=this.resolution;r=r||i,n&&((o=l).copyFrom(e),o.prepend(n)),t?this.context.setTransform(o.a*r,o.b*r,o.c*r,o.d*r,o.tx*i|0,o.ty*i|0):this.context.setTransform(o.a*r,o.b*r,o.c*r,o.d*r,o.tx*i,o.ty*i)},s.prototype.clear=function(e,t){void 0===e&&(e=this._backgroundColorString),void 0===t&&(t=this.backgroundAlpha);var r=this.context;r.clearRect(0,0,this.width,this.height),e&&(r.globalAlpha=this.useContextAlpha?t:1,r.fillStyle=e,r.fillRect(0,0,this.width,this.height),r.globalAlpha=1)},s.prototype.setBlendMode=function(e,t){var r=e===o.BLEND_MODES.SRC_IN||e===o.BLEND_MODES.SRC_OUT||e===o.BLEND_MODES.DST_IN||e===o.BLEND_MODES.DST_ATOP;!t&&r&&(e=o.BLEND_MODES.NORMAL),this._activeBlendMode!==e&&(this._activeBlendMode=e,this._outerBlend=r,this.context.globalCompositeOperation=this.blendModes[e])},s.prototype.destroy=function(e){r.prototype.destroy.call(this,e),this.context=null,this.refresh=!0,this.maskManager.destroy(),this.maskManager=null,this.smoothProperty=null},s.prototype.resize=function(e,t){r.prototype.resize.call(this,e,t),this.smoothProperty&&(this.rootContext[this.smoothProperty]=n.settings.SCALE_MODE===o.SCALE_MODES.LINEAR)},s.prototype.invalidateBlendMode=function(){this._activeBlendMode=this.blendModes.indexOf(this.context.globalCompositeOperation)},s.registerPlugin=function(t,r){e.extensions.add({name:t,type:e.ExtensionType.CanvasRendererPlugin,ref:r})},s.__plugins={},s}(e.AbstractRenderer);e.extensions.handleByMap(e.ExtensionType.CanvasRendererPlugin,c.__plugins);var d={canvas:null,getTintedCanvas:function(e,t){var r=e.texture,o="#"+("00000"+(0|(t=d.roundColor(t))).toString(16)).slice(-6);r.tintCache=r.tintCache||{};var n,i=r.tintCache[o];if(i){if(i.tintId===r._updateID)return r.tintCache[o];n=r.tintCache[o]}else n=document.createElement("canvas");if(d.tintMethod(r,t,n),n.tintId=r._updateID,d.convertTintToImage){var a=new Image;a.src=n.toDataURL(),r.tintCache[o]=a}else r.tintCache[o]=n;return n},getTintedPattern:function(e,t){var r="#"+("00000"+(0|(t=d.roundColor(t))).toString(16)).slice(-6);e.patternCache=e.patternCache||{};var o=e.patternCache[r];return o&&o.tintId===e._updateID||(d.canvas||(d.canvas=document.createElement("canvas")),d.tintMethod(e,t,d.canvas),(o=d.canvas.getContext("2d").createPattern(d.canvas,"repeat")).tintId=e._updateID,e.patternCache[r]=o),o},tintWithMultiply:function(e,t,r){var o=r.getContext("2d"),n=e._frame.clone(),i=e.baseTexture.resolution;n.x*=i,n.y*=i,n.width*=i,n.height*=i,r.width=Math.ceil(n.width),r.height=Math.ceil(n.height),o.save(),o.fillStyle="#"+("00000"+(0|t).toString(16)).slice(-6),o.fillRect(0,0,n.width,n.height),o.globalCompositeOperation="multiply";var a=e.baseTexture.getDrawableSource();o.drawImage(a,n.x,n.y,n.width,n.height,0,0,n.width,n.height),o.globalCompositeOperation="destination-atop",o.drawImage(a,n.x,n.y,n.width,n.height,0,0,n.width,n.height),o.restore()},tintWithOverlay:function(e,t,r){var o=r.getContext("2d"),n=e._frame.clone(),i=e.baseTexture.resolution;n.x*=i,n.y*=i,n.width*=i,n.height*=i,r.width=Math.ceil(n.width),r.height=Math.ceil(n.height),o.save(),o.globalCompositeOperation="copy",o.fillStyle="#"+("00000"+(0|t).toString(16)).slice(-6),o.fillRect(0,0,n.width,n.height),o.globalCompositeOperation="destination-atop",o.drawImage(e.baseTexture.getDrawableSource(),n.x,n.y,n.width,n.height,0,0,n.width,n.height),o.restore()},tintWithPerPixel:function(e,r,o){var n=o.getContext("2d"),i=e._frame.clone(),a=e.baseTexture.resolution;i.x*=a,i.y*=a,i.width*=a,i.height*=a,o.width=Math.ceil(i.width),o.height=Math.ceil(i.height),n.save(),n.globalCompositeOperation="copy",n.drawImage(e.baseTexture.getDrawableSource(),i.x,i.y,i.width,i.height,0,0,i.width,i.height),n.restore();for(var s=t.hex2rgb(r),h=s[0],l=s[1],c=s[2],d=n.getImageData(0,0,i.width,i.height),u=d.data,p=0;p<u.length;p+=4)u[p+0]*=h,u[p+1]*=l,u[p+2]*=c;n.putImageData(d,0,0)},roundColor:function(e){var r=d.cacheStepsPerColorChannel,o=t.hex2rgb(e);return o[0]=Math.min(255,o[0]/r*r),o[1]=Math.min(255,o[1]/r*r),o[2]=Math.min(255,o[2]/r*r),t.rgb2hex(o)},cacheStepsPerColorChannel:8,convertTintToImage:!1,canUseMultiply:h(),tintMethod:null};d.tintMethod=d.canUseMultiply?d.tintWithMultiply:d.tintWithPerPixel;var u=e.Renderer.create;e.Renderer.create=function(e){if(!(e&&e.forceCanvas))try{return u(e)}catch(e){}return new c(e)},e.BaseTexture.prototype.getDrawableSource=function(){var e=this.resource;return e?e.bitmap||e.source:null},e.BaseRenderTexture.prototype._canvasRenderTarget=null,e.Texture.prototype.patternCache=null,e.Texture.prototype.tintCache=null,exports.CanvasRenderer=c,exports.canUseNewCanvasBlendModes=h,exports.canvasUtils=d;
//# sourceMappingURL=canvas-renderer.min.js.map
/*!
* @pixi/canvas-renderer - v6.4.2
* Compiled Thu, 02 Jun 2022 15:39:26 UTC
* @pixi/canvas-renderer - v6.5.0-rc
* Compiled Thu, 14 Jul 2022 18:30:46 UTC
*

@@ -8,3 +8,3 @@ * @pixi/canvas-renderer is licensed under the MIT License.

*/
import { RenderTexture, BaseRenderTexture, CanvasResource, AbstractRenderer, Renderer, BaseTexture, Texture } from '@pixi/core';
import { RenderTexture, BaseRenderTexture, CanvasResource, extensions, ExtensionType, AbstractRenderer, Renderer, BaseTexture, Texture } from '@pixi/core';
import { deprecation, CanvasRenderTarget, hex2string, rgb2hex, sayHello, hex2rgb } from '@pixi/utils';

@@ -16,14 +16,14 @@ import { SHAPES, Matrix } from '@pixi/math';

/*! *****************************************************************************
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
Copyright (c) Microsoft Corporation.
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.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */

@@ -281,2 +281,3 @@ /* global Reflect, Promise */

*/
// TODO after upgrading to typeScript 4.6, replace `string[]` with `GlobalCompositeOperation[]`
function mapCanvasBlendModesToPixi(array) {

@@ -299,3 +300,3 @@ if (array === void 0) { array = []; }

array[BLEND_MODES.HUE] = 'hue';
array[BLEND_MODES.SATURATION] = 'saturate';
array[BLEND_MODES.SATURATION] = 'saturation';
array[BLEND_MODES.COLOR] = 'color';

@@ -617,3 +618,4 @@ array[BLEND_MODES.LUMINOSITY] = 'luminosity';

/**
* Adds a plugin to the renderer.
* Use the {@link PIXI.extensions.add} API to register plugins.
* @deprecated since 6.5.0
* @param pluginName - The name of the plugin.

@@ -623,7 +625,13 @@ * @param ctor - The constructor function or class for the plugin.

CanvasRenderer.registerPlugin = function (pluginName, ctor) {
CanvasRenderer.__plugins = CanvasRenderer.__plugins || {};
CanvasRenderer.__plugins[pluginName] = ctor;
deprecation('6.5.0', 'CanvasRenderer.registerPlugin() has been deprecated, please use extensions.add() instead.');
extensions.add({
name: pluginName,
type: ExtensionType.CanvasRendererPlugin,
ref: ctor,
});
};
CanvasRenderer.__plugins = {};
return CanvasRenderer;
}(AbstractRenderer));
extensions.handleByMap(ExtensionType.CanvasRendererPlugin, CanvasRenderer.__plugins);

@@ -630,0 +638,0 @@ /**

/*!
* @pixi/canvas-renderer - v6.4.2
* Compiled Thu, 02 Jun 2022 15:39:26 UTC
* @pixi/canvas-renderer - v6.5.0-rc
* Compiled Thu, 14 Jul 2022 18:30:46 UTC
*

@@ -8,3 +8,3 @@ * @pixi/canvas-renderer is licensed under the MIT License.

*/
import{CanvasResource as e,AbstractRenderer as t,RenderTexture as o,BaseRenderTexture as r,Renderer as i,BaseTexture as n,Texture as a}from"@pixi/core";import{CanvasRenderTarget as h,hex2string as s,rgb2hex as l,sayHello as c,hex2rgb as d}from"@pixi/utils";import{SHAPES as u,Matrix as p}from"@pixi/math";import{BLEND_MODES as g,SCALE_MODES as v,RENDERER_TYPE as f}from"@pixi/constants";import{settings as m}from"@pixi/settings";var T=function(e,t){return T=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])},T(e,t)};var C=function(){function e(e){this._foundShapes=[],this.renderer=e}return e.prototype.pushMask=function(e){var t=this.renderer,o=e.maskObject||e;t.context.save();var r=this._foundShapes;if(this.recursiveFindShapes(o,r),r.length>0){var i=t.context;i.beginPath();for(var n=0;n<r.length;n++){var a=r[n],h=a.transform.worldTransform;this.renderer.setContextTransform(h),this.renderGraphicsShape(a)}r.length=0,i.clip()}},e.prototype.recursiveFindShapes=function(e,t){e.geometry&&e.geometry.graphicsData&&t.push(e);var o=e.children;if(o)for(var r=0;r<o.length;r++)this.recursiveFindShapes(o[r],t)},e.prototype.renderGraphicsShape=function(e){e.finishPoly();var t=this.renderer.context,o=e.geometry.graphicsData,r=o.length;if(0!==r)for(var i=0;i<r;i++){var n=o[i],a=n.shape;if(a.type===u.POLY){var h=a.points,s=n.holes,l=void 0,c=void 0,d=void 0,p=void 0;t.moveTo(h[0],h[1]);for(var g=1;g<h.length/2;g++)t.lineTo(h[2*g],h[2*g+1]);if(s.length>0){l=0,d=h[0],p=h[1];for(g=2;g+2<h.length;g+=2)l+=(h[g]-d)*(h[g+3]-p)-(h[g+2]-d)*(h[g+1]-p);for(var v=0;v<s.length;v++)if(h=s[v].shape.points){c=0,d=h[0],p=h[1];for(g=2;g+2<h.length;g+=2)c+=(h[g]-d)*(h[g+3]-p)-(h[g+2]-d)*(h[g+1]-p);if(c*l<0){t.moveTo(h[0],h[1]);for(g=2;g<h.length;g+=2)t.lineTo(h[g],h[g+1])}else{t.moveTo(h[h.length-2],h[h.length-1]);for(g=h.length-4;g>=0;g-=2)t.lineTo(h[g],h[g+1])}s[v].shape.closeStroke&&t.closePath()}}h[0]===h[h.length-2]&&h[1]===h[h.length-1]&&t.closePath()}else if(a.type===u.RECT)t.rect(a.x,a.y,a.width,a.height),t.closePath();else if(a.type===u.CIRC)t.arc(a.x,a.y,a.radius,0,2*Math.PI),t.closePath();else if(a.type===u.ELIP){var f=2*a.width,m=2*a.height,T=a.x-f/2,C=a.y-m/2,y=.5522848,x=f/2*y,_=m/2*y,S=T+f,b=C+m,R=T+f/2,O=C+m/2;t.moveTo(T,O),t.bezierCurveTo(T,O-_,R-x,C,R,C),t.bezierCurveTo(R+x,C,S,O-_,S,O),t.bezierCurveTo(S,O+_,R+x,b,R,b),t.bezierCurveTo(R-x,b,T,O+_,T,O),t.closePath()}else if(a.type===u.RREC){var w=a.x,I=a.y,M=a.width,E=a.height,A=a.radius,P=Math.min(M,E)/2;A=A>P?P:A,t.moveTo(w,I+A),t.lineTo(w,I+E-A),t.quadraticCurveTo(w,I+E,w+A,I+E),t.lineTo(w+M-A,I+E),t.quadraticCurveTo(w+M,I+E,w+M,I+E-A),t.lineTo(w+M,I+A),t.quadraticCurveTo(w+M,I,w+M-A,I),t.lineTo(w+A,I),t.quadraticCurveTo(w,I,w,I+A),t.closePath()}}},e.prototype.popMask=function(e){e.context.restore(),e.invalidateBlendMode()},e.prototype.destroy=function(){},e}();function y(e){var t=document.createElement("canvas");t.width=6,t.height=1;var o=t.getContext("2d");return o.fillStyle=e,o.fillRect(0,0,6,1),t}function x(){if("undefined"==typeof document)return!1;var e=y("#ff00ff"),t=y("#ffff00"),o=document.createElement("canvas");o.width=6,o.height=1;var r=o.getContext("2d");r.globalCompositeOperation="multiply",r.drawImage(e,0,0),r.drawImage(t,2,0);var i=r.getImageData(2,0,1,1);if(!i)return!1;var n=i.data;return 255===n[0]&&0===n[1]&&0===n[2]}var _=new p,S=function(t){function i(e){var o,r=t.call(this,f.CANVAS,e)||this;if(r.refresh=!0,r.maskManager=new C(r),r.smoothProperty="imageSmoothingEnabled",r.blendModes=(void 0===o&&(o=[]),x()?(o[g.NORMAL]="source-over",o[g.ADD]="lighter",o[g.MULTIPLY]="multiply",o[g.SCREEN]="screen",o[g.OVERLAY]="overlay",o[g.DARKEN]="darken",o[g.LIGHTEN]="lighten",o[g.COLOR_DODGE]="color-dodge",o[g.COLOR_BURN]="color-burn",o[g.HARD_LIGHT]="hard-light",o[g.SOFT_LIGHT]="soft-light",o[g.DIFFERENCE]="difference",o[g.EXCLUSION]="exclusion",o[g.HUE]="hue",o[g.SATURATION]="saturate",o[g.COLOR]="color",o[g.LUMINOSITY]="luminosity"):(o[g.NORMAL]="source-over",o[g.ADD]="lighter",o[g.MULTIPLY]="source-over",o[g.SCREEN]="source-over",o[g.OVERLAY]="source-over",o[g.DARKEN]="source-over",o[g.LIGHTEN]="source-over",o[g.COLOR_DODGE]="source-over",o[g.COLOR_BURN]="source-over",o[g.HARD_LIGHT]="source-over",o[g.SOFT_LIGHT]="source-over",o[g.DIFFERENCE]="source-over",o[g.EXCLUSION]="source-over",o[g.HUE]="source-over",o[g.SATURATION]="source-over",o[g.COLOR]="source-over",o[g.LUMINOSITY]="source-over"),o[g.NORMAL_NPM]=o[g.NORMAL],o[g.ADD_NPM]=o[g.ADD],o[g.SCREEN_NPM]=o[g.SCREEN],o[g.SRC_IN]="source-in",o[g.SRC_OUT]="source-out",o[g.SRC_ATOP]="source-atop",o[g.DST_OVER]="destination-over",o[g.DST_IN]="destination-in",o[g.DST_OUT]="destination-out",o[g.DST_ATOP]="destination-atop",o[g.XOR]="xor",o[g.SUBTRACT]="source-over",o),r.renderingToScreen=!1,r._activeBlendMode=null,r._projTransform=null,r._outerBlend=!1,r.rootContext=r.view.getContext("2d",{alpha:r.useContextAlpha}),r.context=r.rootContext,!r.rootContext.imageSmoothingEnabled){var n=r.rootContext;n.webkitImageSmoothingEnabled?r.smoothProperty="webkitImageSmoothingEnabled":n.mozImageSmoothingEnabled?r.smoothProperty="mozImageSmoothingEnabled":n.oImageSmoothingEnabled?r.smoothProperty="oImageSmoothingEnabled":n.msImageSmoothingEnabled&&(r.smoothProperty="msImageSmoothingEnabled")}return r.initPlugins(i.__plugins),c("Canvas"),r.resize(r.options.width,r.options.height),r}return function(e,t){function o(){this.constructor=e}T(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}(i,t),i.prototype.addSystem=function(){return this},i.prototype.render=function(t,i){if(this.view){var n,a,c,d;i&&(i instanceof o||i instanceof r?(n=i,a=arguments[2],c=arguments[3],d=arguments[4]):(n=i.renderTexture,a=i.clear,c=i.transform,d=i.skipUpdateTransform)),this.renderingToScreen=!n,this.emit("prerender");var u=this.resolution;n?((n=n.castToBaseTexture())._canvasRenderTarget||(n._canvasRenderTarget=new h(n.width,n.height,n.resolution),n.resource=new e(n._canvasRenderTarget.canvas),n.valid=!0),this.context=n._canvasRenderTarget.context,this.resolution=n._canvasRenderTarget.resolution):this.context=this.rootContext;var p=this.context;if(this._projTransform=c||null,n||(this._lastObjectRendered=t),!d){var v=t.enableTempParent();t.updateTransform(),t.disableTempParent(v)}if(p.save(),p.setTransform(1,0,0,1,0,0),p.globalAlpha=1,this._activeBlendMode=g.NORMAL,this._outerBlend=!1,p.globalCompositeOperation=this.blendModes[g.NORMAL],void 0!==a?a:this.clearBeforeRender)if(this.renderingToScreen)p.clearRect(0,0,this.width,this.height),this.backgroundAlpha>0&&(p.globalAlpha=this.useContextAlpha?this.backgroundAlpha:1,p.fillStyle=this._backgroundColorString,p.fillRect(0,0,this.width,this.height),p.globalAlpha=1);else{(n=n)._canvasRenderTarget.clear();var f=n.clearColor;f[3]>0&&(p.globalAlpha=this.useContextAlpha?f[3]:1,p.fillStyle=s(l(f)),p.fillRect(0,0,n.realWidth,n.realHeight),p.globalAlpha=1)}var m=this.context;this.context=p,t.renderCanvas(this),this.context=m,p.restore(),this.resolution=u,this._projTransform=null,this.emit("postrender")}},i.prototype.setContextTransform=function(e,t,o){var r=e,i=this._projTransform,n=this.resolution;o=o||n,i&&((r=_).copyFrom(e),r.prepend(i)),t?this.context.setTransform(r.a*o,r.b*o,r.c*o,r.d*o,r.tx*n|0,r.ty*n|0):this.context.setTransform(r.a*o,r.b*o,r.c*o,r.d*o,r.tx*n,r.ty*n)},i.prototype.clear=function(e,t){void 0===e&&(e=this._backgroundColorString),void 0===t&&(t=this.backgroundAlpha);var o=this.context;o.clearRect(0,0,this.width,this.height),e&&(o.globalAlpha=this.useContextAlpha?t:1,o.fillStyle=e,o.fillRect(0,0,this.width,this.height),o.globalAlpha=1)},i.prototype.setBlendMode=function(e,t){var o=e===g.SRC_IN||e===g.SRC_OUT||e===g.DST_IN||e===g.DST_ATOP;!t&&o&&(e=g.NORMAL),this._activeBlendMode!==e&&(this._activeBlendMode=e,this._outerBlend=o,this.context.globalCompositeOperation=this.blendModes[e])},i.prototype.destroy=function(e){t.prototype.destroy.call(this,e),this.context=null,this.refresh=!0,this.maskManager.destroy(),this.maskManager=null,this.smoothProperty=null},i.prototype.resize=function(e,o){t.prototype.resize.call(this,e,o),this.smoothProperty&&(this.rootContext[this.smoothProperty]=m.SCALE_MODE===v.LINEAR)},i.prototype.invalidateBlendMode=function(){this._activeBlendMode=this.blendModes.indexOf(this.context.globalCompositeOperation)},i.registerPlugin=function(e,t){i.__plugins=i.__plugins||{},i.__plugins[e]=t},i}(t),b={canvas:null,getTintedCanvas:function(e,t){var o=e.texture,r="#"+("00000"+(0|(t=b.roundColor(t))).toString(16)).slice(-6);o.tintCache=o.tintCache||{};var i,n=o.tintCache[r];if(n){if(n.tintId===o._updateID)return o.tintCache[r];i=o.tintCache[r]}else i=document.createElement("canvas");if(b.tintMethod(o,t,i),i.tintId=o._updateID,b.convertTintToImage){var a=new Image;a.src=i.toDataURL(),o.tintCache[r]=a}else o.tintCache[r]=i;return i},getTintedPattern:function(e,t){var o="#"+("00000"+(0|(t=b.roundColor(t))).toString(16)).slice(-6);e.patternCache=e.patternCache||{};var r=e.patternCache[o];return r&&r.tintId===e._updateID||(b.canvas||(b.canvas=document.createElement("canvas")),b.tintMethod(e,t,b.canvas),(r=b.canvas.getContext("2d").createPattern(b.canvas,"repeat")).tintId=e._updateID,e.patternCache[o]=r),r},tintWithMultiply:function(e,t,o){var r=o.getContext("2d"),i=e._frame.clone(),n=e.baseTexture.resolution;i.x*=n,i.y*=n,i.width*=n,i.height*=n,o.width=Math.ceil(i.width),o.height=Math.ceil(i.height),r.save(),r.fillStyle="#"+("00000"+(0|t).toString(16)).slice(-6),r.fillRect(0,0,i.width,i.height),r.globalCompositeOperation="multiply";var a=e.baseTexture.getDrawableSource();r.drawImage(a,i.x,i.y,i.width,i.height,0,0,i.width,i.height),r.globalCompositeOperation="destination-atop",r.drawImage(a,i.x,i.y,i.width,i.height,0,0,i.width,i.height),r.restore()},tintWithOverlay:function(e,t,o){var r=o.getContext("2d"),i=e._frame.clone(),n=e.baseTexture.resolution;i.x*=n,i.y*=n,i.width*=n,i.height*=n,o.width=Math.ceil(i.width),o.height=Math.ceil(i.height),r.save(),r.globalCompositeOperation="copy",r.fillStyle="#"+("00000"+(0|t).toString(16)).slice(-6),r.fillRect(0,0,i.width,i.height),r.globalCompositeOperation="destination-atop",r.drawImage(e.baseTexture.getDrawableSource(),i.x,i.y,i.width,i.height,0,0,i.width,i.height),r.restore()},tintWithPerPixel:function(e,t,o){var r=o.getContext("2d"),i=e._frame.clone(),n=e.baseTexture.resolution;i.x*=n,i.y*=n,i.width*=n,i.height*=n,o.width=Math.ceil(i.width),o.height=Math.ceil(i.height),r.save(),r.globalCompositeOperation="copy",r.drawImage(e.baseTexture.getDrawableSource(),i.x,i.y,i.width,i.height,0,0,i.width,i.height),r.restore();for(var a=d(t),h=a[0],s=a[1],l=a[2],c=r.getImageData(0,0,i.width,i.height),u=c.data,p=0;p<u.length;p+=4)u[p+0]*=h,u[p+1]*=s,u[p+2]*=l;r.putImageData(c,0,0)},roundColor:function(e){var t=b.cacheStepsPerColorChannel,o=d(e);return o[0]=Math.min(255,o[0]/t*t),o[1]=Math.min(255,o[1]/t*t),o[2]=Math.min(255,o[2]/t*t),l(o)},cacheStepsPerColorChannel:8,convertTintToImage:!1,canUseMultiply:x(),tintMethod:null};b.tintMethod=b.canUseMultiply?b.tintWithMultiply:b.tintWithPerPixel;var R=i.create;i.create=function(e){if(!(e&&e.forceCanvas))try{return R(e)}catch(e){}return new S(e)},n.prototype.getDrawableSource=function(){var e=this.resource;return e?e.bitmap||e.source:null},r.prototype._canvasRenderTarget=null,a.prototype.patternCache=null,a.prototype.tintCache=null;export{S as CanvasRenderer,x as canUseNewCanvasBlendModes,b as canvasUtils};
import{CanvasResource as e,extensions as t,ExtensionType as o,AbstractRenderer as r,RenderTexture as i,BaseRenderTexture as n,Renderer as a,BaseTexture as h,Texture as s}from"@pixi/core";import{CanvasRenderTarget as l,hex2string as c,rgb2hex as d,sayHello as u,hex2rgb as p}from"@pixi/utils";import{SHAPES as g,Matrix as v}from"@pixi/math";import{BLEND_MODES as f,SCALE_MODES as m,RENDERER_TYPE as C}from"@pixi/constants";import{settings as T}from"@pixi/settings";var y=function(e,t){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])},y(e,t)};var x=function(){function e(e){this._foundShapes=[],this.renderer=e}return e.prototype.pushMask=function(e){var t=this.renderer,o=e.maskObject||e;t.context.save();var r=this._foundShapes;if(this.recursiveFindShapes(o,r),r.length>0){var i=t.context;i.beginPath();for(var n=0;n<r.length;n++){var a=r[n],h=a.transform.worldTransform;this.renderer.setContextTransform(h),this.renderGraphicsShape(a)}r.length=0,i.clip()}},e.prototype.recursiveFindShapes=function(e,t){e.geometry&&e.geometry.graphicsData&&t.push(e);var o=e.children;if(o)for(var r=0;r<o.length;r++)this.recursiveFindShapes(o[r],t)},e.prototype.renderGraphicsShape=function(e){e.finishPoly();var t=this.renderer.context,o=e.geometry.graphicsData,r=o.length;if(0!==r)for(var i=0;i<r;i++){var n=o[i],a=n.shape;if(a.type===g.POLY){var h=a.points,s=n.holes,l=void 0,c=void 0,d=void 0,u=void 0;t.moveTo(h[0],h[1]);for(var p=1;p<h.length/2;p++)t.lineTo(h[2*p],h[2*p+1]);if(s.length>0){l=0,d=h[0],u=h[1];for(p=2;p+2<h.length;p+=2)l+=(h[p]-d)*(h[p+3]-u)-(h[p+2]-d)*(h[p+1]-u);for(var v=0;v<s.length;v++)if(h=s[v].shape.points){c=0,d=h[0],u=h[1];for(p=2;p+2<h.length;p+=2)c+=(h[p]-d)*(h[p+3]-u)-(h[p+2]-d)*(h[p+1]-u);if(c*l<0){t.moveTo(h[0],h[1]);for(p=2;p<h.length;p+=2)t.lineTo(h[p],h[p+1])}else{t.moveTo(h[h.length-2],h[h.length-1]);for(p=h.length-4;p>=0;p-=2)t.lineTo(h[p],h[p+1])}s[v].shape.closeStroke&&t.closePath()}}h[0]===h[h.length-2]&&h[1]===h[h.length-1]&&t.closePath()}else if(a.type===g.RECT)t.rect(a.x,a.y,a.width,a.height),t.closePath();else if(a.type===g.CIRC)t.arc(a.x,a.y,a.radius,0,2*Math.PI),t.closePath();else if(a.type===g.ELIP){var f=2*a.width,m=2*a.height,C=a.x-f/2,T=a.y-m/2,y=.5522848,x=f/2*y,_=m/2*y,S=C+f,b=T+m,R=C+f/2,O=T+m/2;t.moveTo(C,O),t.bezierCurveTo(C,O-_,R-x,T,R,T),t.bezierCurveTo(R+x,T,S,O-_,S,O),t.bezierCurveTo(S,O+_,R+x,b,R,b),t.bezierCurveTo(R-x,b,C,O+_,C,O),t.closePath()}else if(a.type===g.RREC){var w=a.x,I=a.y,M=a.width,E=a.height,A=a.radius,P=Math.min(M,E)/2;A=A>P?P:A,t.moveTo(w,I+A),t.lineTo(w,I+E-A),t.quadraticCurveTo(w,I+E,w+A,I+E),t.lineTo(w+M-A,I+E),t.quadraticCurveTo(w+M,I+E,w+M,I+E-A),t.lineTo(w+M,I+A),t.quadraticCurveTo(w+M,I,w+M-A,I),t.lineTo(w+A,I),t.quadraticCurveTo(w,I,w,I+A),t.closePath()}}},e.prototype.popMask=function(e){e.context.restore(),e.invalidateBlendMode()},e.prototype.destroy=function(){},e}();function _(e){var t=document.createElement("canvas");t.width=6,t.height=1;var o=t.getContext("2d");return o.fillStyle=e,o.fillRect(0,0,6,1),t}function S(){if("undefined"==typeof document)return!1;var e=_("#ff00ff"),t=_("#ffff00"),o=document.createElement("canvas");o.width=6,o.height=1;var r=o.getContext("2d");r.globalCompositeOperation="multiply",r.drawImage(e,0,0),r.drawImage(t,2,0);var i=r.getImageData(2,0,1,1);if(!i)return!1;var n=i.data;return 255===n[0]&&0===n[1]&&0===n[2]}var b=new v,R=function(r){function a(e){var t,o=r.call(this,C.CANVAS,e)||this;if(o.refresh=!0,o.maskManager=new x(o),o.smoothProperty="imageSmoothingEnabled",o.blendModes=(void 0===t&&(t=[]),S()?(t[f.NORMAL]="source-over",t[f.ADD]="lighter",t[f.MULTIPLY]="multiply",t[f.SCREEN]="screen",t[f.OVERLAY]="overlay",t[f.DARKEN]="darken",t[f.LIGHTEN]="lighten",t[f.COLOR_DODGE]="color-dodge",t[f.COLOR_BURN]="color-burn",t[f.HARD_LIGHT]="hard-light",t[f.SOFT_LIGHT]="soft-light",t[f.DIFFERENCE]="difference",t[f.EXCLUSION]="exclusion",t[f.HUE]="hue",t[f.SATURATION]="saturation",t[f.COLOR]="color",t[f.LUMINOSITY]="luminosity"):(t[f.NORMAL]="source-over",t[f.ADD]="lighter",t[f.MULTIPLY]="source-over",t[f.SCREEN]="source-over",t[f.OVERLAY]="source-over",t[f.DARKEN]="source-over",t[f.LIGHTEN]="source-over",t[f.COLOR_DODGE]="source-over",t[f.COLOR_BURN]="source-over",t[f.HARD_LIGHT]="source-over",t[f.SOFT_LIGHT]="source-over",t[f.DIFFERENCE]="source-over",t[f.EXCLUSION]="source-over",t[f.HUE]="source-over",t[f.SATURATION]="source-over",t[f.COLOR]="source-over",t[f.LUMINOSITY]="source-over"),t[f.NORMAL_NPM]=t[f.NORMAL],t[f.ADD_NPM]=t[f.ADD],t[f.SCREEN_NPM]=t[f.SCREEN],t[f.SRC_IN]="source-in",t[f.SRC_OUT]="source-out",t[f.SRC_ATOP]="source-atop",t[f.DST_OVER]="destination-over",t[f.DST_IN]="destination-in",t[f.DST_OUT]="destination-out",t[f.DST_ATOP]="destination-atop",t[f.XOR]="xor",t[f.SUBTRACT]="source-over",t),o.renderingToScreen=!1,o._activeBlendMode=null,o._projTransform=null,o._outerBlend=!1,o.rootContext=o.view.getContext("2d",{alpha:o.useContextAlpha}),o.context=o.rootContext,!o.rootContext.imageSmoothingEnabled){var i=o.rootContext;i.webkitImageSmoothingEnabled?o.smoothProperty="webkitImageSmoothingEnabled":i.mozImageSmoothingEnabled?o.smoothProperty="mozImageSmoothingEnabled":i.oImageSmoothingEnabled?o.smoothProperty="oImageSmoothingEnabled":i.msImageSmoothingEnabled&&(o.smoothProperty="msImageSmoothingEnabled")}return o.initPlugins(a.__plugins),u("Canvas"),o.resize(o.options.width,o.options.height),o}return function(e,t){function o(){this.constructor=e}y(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}(a,r),a.prototype.addSystem=function(){return this},a.prototype.render=function(t,o){if(this.view){var r,a,h,s;o&&(o instanceof i||o instanceof n?(r=o,a=arguments[2],h=arguments[3],s=arguments[4]):(r=o.renderTexture,a=o.clear,h=o.transform,s=o.skipUpdateTransform)),this.renderingToScreen=!r,this.emit("prerender");var u=this.resolution;r?((r=r.castToBaseTexture())._canvasRenderTarget||(r._canvasRenderTarget=new l(r.width,r.height,r.resolution),r.resource=new e(r._canvasRenderTarget.canvas),r.valid=!0),this.context=r._canvasRenderTarget.context,this.resolution=r._canvasRenderTarget.resolution):this.context=this.rootContext;var p=this.context;if(this._projTransform=h||null,r||(this._lastObjectRendered=t),!s){var g=t.enableTempParent();t.updateTransform(),t.disableTempParent(g)}if(p.save(),p.setTransform(1,0,0,1,0,0),p.globalAlpha=1,this._activeBlendMode=f.NORMAL,this._outerBlend=!1,p.globalCompositeOperation=this.blendModes[f.NORMAL],void 0!==a?a:this.clearBeforeRender)if(this.renderingToScreen)p.clearRect(0,0,this.width,this.height),this.backgroundAlpha>0&&(p.globalAlpha=this.useContextAlpha?this.backgroundAlpha:1,p.fillStyle=this._backgroundColorString,p.fillRect(0,0,this.width,this.height),p.globalAlpha=1);else{(r=r)._canvasRenderTarget.clear();var v=r.clearColor;v[3]>0&&(p.globalAlpha=this.useContextAlpha?v[3]:1,p.fillStyle=c(d(v)),p.fillRect(0,0,r.realWidth,r.realHeight),p.globalAlpha=1)}var m=this.context;this.context=p,t.renderCanvas(this),this.context=m,p.restore(),this.resolution=u,this._projTransform=null,this.emit("postrender")}},a.prototype.setContextTransform=function(e,t,o){var r=e,i=this._projTransform,n=this.resolution;o=o||n,i&&((r=b).copyFrom(e),r.prepend(i)),t?this.context.setTransform(r.a*o,r.b*o,r.c*o,r.d*o,r.tx*n|0,r.ty*n|0):this.context.setTransform(r.a*o,r.b*o,r.c*o,r.d*o,r.tx*n,r.ty*n)},a.prototype.clear=function(e,t){void 0===e&&(e=this._backgroundColorString),void 0===t&&(t=this.backgroundAlpha);var o=this.context;o.clearRect(0,0,this.width,this.height),e&&(o.globalAlpha=this.useContextAlpha?t:1,o.fillStyle=e,o.fillRect(0,0,this.width,this.height),o.globalAlpha=1)},a.prototype.setBlendMode=function(e,t){var o=e===f.SRC_IN||e===f.SRC_OUT||e===f.DST_IN||e===f.DST_ATOP;!t&&o&&(e=f.NORMAL),this._activeBlendMode!==e&&(this._activeBlendMode=e,this._outerBlend=o,this.context.globalCompositeOperation=this.blendModes[e])},a.prototype.destroy=function(e){r.prototype.destroy.call(this,e),this.context=null,this.refresh=!0,this.maskManager.destroy(),this.maskManager=null,this.smoothProperty=null},a.prototype.resize=function(e,t){r.prototype.resize.call(this,e,t),this.smoothProperty&&(this.rootContext[this.smoothProperty]=T.SCALE_MODE===m.LINEAR)},a.prototype.invalidateBlendMode=function(){this._activeBlendMode=this.blendModes.indexOf(this.context.globalCompositeOperation)},a.registerPlugin=function(e,r){t.add({name:e,type:o.CanvasRendererPlugin,ref:r})},a.__plugins={},a}(r);t.handleByMap(o.CanvasRendererPlugin,R.__plugins);var O={canvas:null,getTintedCanvas:function(e,t){var o=e.texture,r="#"+("00000"+(0|(t=O.roundColor(t))).toString(16)).slice(-6);o.tintCache=o.tintCache||{};var i,n=o.tintCache[r];if(n){if(n.tintId===o._updateID)return o.tintCache[r];i=o.tintCache[r]}else i=document.createElement("canvas");if(O.tintMethod(o,t,i),i.tintId=o._updateID,O.convertTintToImage){var a=new Image;a.src=i.toDataURL(),o.tintCache[r]=a}else o.tintCache[r]=i;return i},getTintedPattern:function(e,t){var o="#"+("00000"+(0|(t=O.roundColor(t))).toString(16)).slice(-6);e.patternCache=e.patternCache||{};var r=e.patternCache[o];return r&&r.tintId===e._updateID||(O.canvas||(O.canvas=document.createElement("canvas")),O.tintMethod(e,t,O.canvas),(r=O.canvas.getContext("2d").createPattern(O.canvas,"repeat")).tintId=e._updateID,e.patternCache[o]=r),r},tintWithMultiply:function(e,t,o){var r=o.getContext("2d"),i=e._frame.clone(),n=e.baseTexture.resolution;i.x*=n,i.y*=n,i.width*=n,i.height*=n,o.width=Math.ceil(i.width),o.height=Math.ceil(i.height),r.save(),r.fillStyle="#"+("00000"+(0|t).toString(16)).slice(-6),r.fillRect(0,0,i.width,i.height),r.globalCompositeOperation="multiply";var a=e.baseTexture.getDrawableSource();r.drawImage(a,i.x,i.y,i.width,i.height,0,0,i.width,i.height),r.globalCompositeOperation="destination-atop",r.drawImage(a,i.x,i.y,i.width,i.height,0,0,i.width,i.height),r.restore()},tintWithOverlay:function(e,t,o){var r=o.getContext("2d"),i=e._frame.clone(),n=e.baseTexture.resolution;i.x*=n,i.y*=n,i.width*=n,i.height*=n,o.width=Math.ceil(i.width),o.height=Math.ceil(i.height),r.save(),r.globalCompositeOperation="copy",r.fillStyle="#"+("00000"+(0|t).toString(16)).slice(-6),r.fillRect(0,0,i.width,i.height),r.globalCompositeOperation="destination-atop",r.drawImage(e.baseTexture.getDrawableSource(),i.x,i.y,i.width,i.height,0,0,i.width,i.height),r.restore()},tintWithPerPixel:function(e,t,o){var r=o.getContext("2d"),i=e._frame.clone(),n=e.baseTexture.resolution;i.x*=n,i.y*=n,i.width*=n,i.height*=n,o.width=Math.ceil(i.width),o.height=Math.ceil(i.height),r.save(),r.globalCompositeOperation="copy",r.drawImage(e.baseTexture.getDrawableSource(),i.x,i.y,i.width,i.height,0,0,i.width,i.height),r.restore();for(var a=p(t),h=a[0],s=a[1],l=a[2],c=r.getImageData(0,0,i.width,i.height),d=c.data,u=0;u<d.length;u+=4)d[u+0]*=h,d[u+1]*=s,d[u+2]*=l;r.putImageData(c,0,0)},roundColor:function(e){var t=O.cacheStepsPerColorChannel,o=p(e);return o[0]=Math.min(255,o[0]/t*t),o[1]=Math.min(255,o[1]/t*t),o[2]=Math.min(255,o[2]/t*t),d(o)},cacheStepsPerColorChannel:8,convertTintToImage:!1,canUseMultiply:S(),tintMethod:null};O.tintMethod=O.canUseMultiply?O.tintWithMultiply:O.tintWithPerPixel;var w=a.create;a.create=function(e){if(!(e&&e.forceCanvas))try{return w(e)}catch(e){}return new R(e)},h.prototype.getDrawableSource=function(){var e=this.resource;return e?e.bitmap||e.source:null},n.prototype._canvasRenderTarget=null,s.prototype.patternCache=null,s.prototype.tintCache=null;export{R as CanvasRenderer,S as canUseNewCanvasBlendModes,O as canvasUtils};
//# sourceMappingURL=canvas-renderer.min.js.map

@@ -194,3 +194,4 @@ /// <reference path="./global.d.ts" />

/**
* Adds a plugin to the renderer.
* Use the {@link PIXI.extensions.add} API to register plugins.
* @deprecated since 6.5.0
* @param pluginName - The name of the plugin.

@@ -197,0 +198,0 @@ * @param ctor - The constructor function or class for the plugin.

{
"name": "@pixi/canvas-renderer",
"version": "6.4.2",
"version": "6.5.0-rc",
"main": "dist/cjs/canvas-renderer.js",

@@ -41,9 +41,9 @@ "module": "dist/esm/canvas-renderer.js",

"peerDependencies": {
"@pixi/constants": "6.4.2",
"@pixi/core": "6.4.2",
"@pixi/math": "6.4.2",
"@pixi/settings": "6.4.2",
"@pixi/utils": "6.4.2"
"@pixi/constants": "6.5.0-rc",
"@pixi/core": "6.5.0-rc",
"@pixi/math": "6.5.0-rc",
"@pixi/settings": "6.5.0-rc",
"@pixi/utils": "6.5.0-rc"
},
"gitHead": "a87bb87036d5fb9119ee92fd9c3da23b5bb9424b"
"gitHead": "16005f83e7a6d87831ce84f8a6d460606a331ef6"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc