text: !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.rexcanvasplugin=e():t.rexcanvasplugin=e()}(window,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=277)}({277:function(t,e,r){"use strict";r.r(e);var n=r(76),i=function(t,e,r,i){var o=new n.a(this.scene,t,e,r,i);return this.scene.add.existing(o),o},o=Phaser.Utils.Objects.GetAdvancedValue,a=Phaser.GameObjects.BuildGameObject,s=function(t,e){var r=o(t,"width",256),i=o(t,"height",r);void 0!==e&&(t.add=e);var s=new n.a(this.scene,0,0,r,i);a(this.scene,s,t);var u=o(t,"fill",null);return s.fill(u),s},u=r(4);function c(t){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function h(t,e){return!e||"object"!==c(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function f(t){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function d(t,e){return(d=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var p=function(t){function e(t){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),r=h(this,f(e).call(this,t)),t.registerGameObject("rexCanvas",i,s),r}var r,n,o;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&d(t,e)}(e,Phaser.Plugins.BasePlugin),r=e,(n=[{key:"start",value:function(){this.game.events.once("destroy",this.destroy,this)}}])&&l(r.prototype,n),o&&l(r,o),e}();Object(u.a)(window,"RexPlugins.GameObjects.Canvas",n.a);e.default=p},4:function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=function(t){return null==t||""===t||0===t.length};e.a=function(t,e,r){if("object"===n(t)){if(i(e)){if(null==r)return;"object"===n(r)&&(t=r)}else{"string"==typeof e&&(e=e.split("."));var o=e.pop();((function(t,e,r){var o=t;if(i(e));else{var a;"string"==typeof e&&(e=e.split("."));for(var s=0,u=e.length;s<u;s++){var c;null!=o[a=e[s]]&&"object"===n(o[a])||(c=s===u-1?void 0===r?{}:r:{},o[a]=c),o=o[a]}}return o})(t,e))[o]=r}return t}}},76:function(t,e,r){"use strict";var n=Phaser.Renderer.WebGL.Utils,i=function(t,e,r,i,o){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){var a=e.frame,s=a.width,u=a.height,c=n.getTintAppendFloatAlpha;this.pipeline.batchTexture(e,a.glTexture,s,u,e.x,e.y,s/e.resolution,u/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,s,u,c(e._tintTL,i.alpha*e._alphaTL),c(e._tintTR,i.alpha*e._alphaTR),c(e._tintBL,i.alpha*e._alphaBL),c(e._tintBR,i.alpha*e._alphaBR),e._isTinted&&e.tintFill,0,0,i,o)}},o=function(t,e,r,n,i){0!==e.width&&0!==e.height&&t.batchSprite(e,e.frame,n,i)},a=r(8),s=(a.a,a.a,{renderWebGL:i,renderCanvas:o}),u=Phaser.Display.Color,c={clear:function(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill:function(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},getPixel:function(t,e,r){void 0===r&&(r=new u);var n=this.context.getImageData(t,e,1,1);return r.setTo(n.data[0],n.data[1],n.data[2],n.data[3]),r},setPixel:function(t,e,r,n,i,o){if("number"!=typeof r){var a=r;r=a.red,n=a.green,i=a.blue,o=a.alpha}void 0===o&&(o=0!==r||0!==n||0!==i?255:0);var s=this.context.createImageData(1,1);return s.data[0]=r,s.data[1]=n,s.data[2]=i,s.data[3]=o,this.context.putImageData(s,t,e),this.dirty=!0,this}},l={updateTexture:function(t,e){t&&(e?t.call(e,this.canvas,this.context):t(this.canvas,this.context)),this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture=this.frame.source.glTexture),this.dirty=!1;var r=this.input;return r&&!r.customHitArea&&(r.hitArea.width=this.width,r.hitArea.height=this.height),this},generateTexture:function(t,e,r,n,i){var o,a=this.canvas,s=this.scene.sys,u=s.game.renderer;void 0===e&&(e=0),void 0===r&&(r=0),void 0===n?n=a.width:n*=this.resolution,void 0===i?i=a.height:i*=this.resolution;var c=(o=s.textures.exists(t)?s.textures.get(t):s.textures.createCanvas(t,n,i)).getSourceImage();c.width!==n&&(c.width=n),c.height!==i&&(c.height=i);var l=c.getContext("2d");return l.clearRect(0,0,n,i),l.drawImage(a,e,r,n,i),u.gl&&o&&u.canvasToTexture(c,o.source[0].glTexture,!0,0),this},loadTexture:function(t,e){var r=this.scene.textures.getFrame(t,e);return r?(this.width!==r.cutWidth||this.height!==r.cutHeight?this.resize(r.cutWidth,r.cutHeight):this.context.clearRect(0,0,r.cutWidth,r.cutHeight),this.context.drawImage(r.source.image,r.cutX,r.cutY,r.cutWidth,r.cutHeight,0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this):this}};function h(t){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function f(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function d(t){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function y(t,e){return(y=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var v=Phaser.Display.Canvas.CanvasPool,g=Phaser.GameObjects.GameObject,b=function(t){function e(t,r,n,i,o){var a,s,u;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),void 0===r&&(r=0),void 0===n&&(n=0),void 0===i&&(i=1),void 0===o&&(o=1),s=this,(a=!(u=d(e).call(this,t,"rexCanvas"))||"object"!==h(u)&&"function"!=typeof u?p(s):u).renderer=t.sys.game.renderer,a.resolution=t.sys.game.config.resolution,a.canvas=v.create(p(a),a.resolution*i,a.resolution*o),a.context=a.canvas.getContext("2d"),a.dirty=!1,a.setPosition(r,n),a.setSize(i,o),a.setOrigin(.5,.5),a.initPipeline(),a._crop=a.resetCropObject(),a.texture=t.sys.textures.addCanvas(null,a.canvas,!0),a.frame=a.texture.get(),a.frame.source.resolution=a.resolution,a.renderer&&a.renderer.gl&&(a.renderer.deleteTexture(a.frame.source.glTexture),a.frame.source.glTexture=null),a.dirty=!0,t.sys.game.events.on("contextrestored",function(){this.dirty=!0},p(a)),a}var r,n,i;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&y(t,e)}(e,g),r=e,(n=[{key:"getCanvas",value:function(t){return t||(this.dirty=!0),this.canvas}},{key:"needRedraw",value:function(){return this.dirty=!0,this}},{key:"preDestroy",value:function(){v.remove(this.canvas)}},{key:"resize",value:function(t,e){return this.width===t&&this.height===e?this:(this.setSize(t,e).updateDisplayOrigin(),t*=this.resolution,e*=this.resolution,t=Math.max(Math.ceil(t),1),e=Math.max(Math.ceil(e),1),this.canvas.width=t,this.canvas.height=e,this.dirty=!0,this)}}])&&f(r.prototype,n),i&&f(r,i),e}(),m=Phaser.GameObjects.Components;Phaser.Class.mixin(b,[m.Alpha,m.BlendMode,m.ComputedSize,m.Crop,m.Depth,m.Flip,m.GetBounds,m.Mask,m.Origin,m.Pipeline,m.ScrollFactor,m.Tint,m.Transform,m.Visible,s,c,l]);e.a=b},8:function(t,e,r){"use strict";e.a=function(){}}}).default});