Socket
Socket
Sign inDemoInstall

@pixi/canvas-renderer

Package Overview
Dependencies
Maintainers
3
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixi/canvas-renderer - npm Package Compare versions

Comparing version 5.0.4 to 5.1.0

8

dist/canvas-renderer.js
/*!
* @pixi/canvas-renderer - v5.0.4
* Compiled Fri, 07 Jun 2019 17:17:49 UTC
* @pixi/canvas-renderer - v5.1.0
* Compiled Fri, 19 Jul 2019 21:54:36 UTC
*

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

);
renderTexture.source = renderTexture._canvasRenderTarget.canvas;
renderTexture.resource = new core.resources.CanvasResource(renderTexture._canvasRenderTarget.canvas);
renderTexture.valid = true;

@@ -689,3 +689,3 @@ }

getTintedCanvas: function (sprite, color) {
var texture = sprite._texture;
var texture = sprite.texture;

@@ -692,0 +692,0 @@ color = CanvasTinter.roundColor(color);

/*!
* @pixi/canvas-renderer - v5.0.4
* Compiled Fri, 07 Jun 2019 17:17:49 UTC
* @pixi/canvas-renderer - v5.1.0
* Compiled Fri, 19 Jul 2019 21:54:36 UTC
*

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

*/
this.PIXI=this.PIXI||{};var _pixi_canvas_renderer=function(t,e,o,r,i,n){"use strict";var a=function(t){this.renderer=t};function s(t){var e=document.createElement("canvas");e.width=6,e.height=1;var o=e.getContext("2d");return o.fillStyle=t,o.fillRect(0,0,6,1),e}function h(){if("undefined"==typeof document)return!1;var t=s("#ff00ff"),e=s("#ffff00"),o=document.createElement("canvas");o.width=6,o.height=1;var r=o.getContext("2d");r.globalCompositeOperation="multiply",r.drawImage(t,0,0),r.drawImage(e,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]}a.prototype.pushMask=function(t){var e=this.renderer;e.context.save();var o=t.alpha,r=t.transform.worldTransform,i=e.resolution;e.context.setTransform(r.a*i,r.b*i,r.c*i,r.d*i,r.tx*i,r.ty*i),t._texture||(this.renderGraphicsShape(t),e.context.clip()),t.worldAlpha=o},a.prototype.renderGraphicsShape=function(t){var e=this.renderer.context,o=t.geometry.graphicsData,i=o.length;if(0!==i){e.beginPath();for(var n=0;n<i;n++){var a=o[n],s=a.shape;if(a.type===r.SHAPES.POLY){var h=s.points;e.moveTo(h[0],h[1]);for(var l=1;l<h.length/2;l++)e.lineTo(h[2*l],h[2*l+1]);h[0]===h[h.length-2]&&h[1]===h[h.length-1]&&e.closePath()}else if(a.type===r.SHAPES.RECT)e.rect(s.x,s.y,s.width,s.height),e.closePath();else if(a.type===r.SHAPES.CIRC)e.arc(s.x,s.y,s.radius,0,2*Math.PI),e.closePath();else if(a.type===r.SHAPES.ELIP){var c=2*s.width,E=2*s.height,d=s.x-c/2,D=s.y-E/2,u=c/2*.5522848,g=E/2*.5522848,_=d+c,p=D+E,S=d+c/2,O=D+E/2;e.moveTo(d,O),e.bezierCurveTo(d,O-g,S-u,D,S,D),e.bezierCurveTo(S+u,D,_,O-g,_,O),e.bezierCurveTo(_,O+g,S+u,p,S,p),e.bezierCurveTo(S-u,p,d,O+g,d,O),e.closePath()}else if(a.type===r.SHAPES.RREC){var v=s.x,M=s.y,m=s.width,N=s.height,L=s.radius,C=Math.min(m,N)/2|0;L=L>C?C:L,e.moveTo(v,M+L),e.lineTo(v,M+N-L),e.quadraticCurveTo(v,M+N,v+L,M+N),e.lineTo(v+m-L,M+N),e.quadraticCurveTo(v+m,M+N,v+m,M+N-L),e.lineTo(v+m,M+L),e.quadraticCurveTo(v+m,M,v+m-L,M),e.lineTo(v+L,M),e.quadraticCurveTo(v,M,v,M+L),e.closePath()}}}},a.prototype.popMask=function(t){t.context.restore(),t.invalidateBlendMode()},a.prototype.destroy=function(){};var l=function(t){function e(r,n,s){var l;t.call(this,"Canvas",r,n,s),this.type=i.RENDERER_TYPE.CANVAS,this.rootContext=this.view.getContext("2d",{alpha:this.transparent}),this.context=this.rootContext,this.refresh=!0,this.maskManager=new a(this),this.smoothProperty="imageSmoothingEnabled",this.rootContext.imageSmoothingEnabled||(this.rootContext.webkitImageSmoothingEnabled?this.smoothProperty="webkitImageSmoothingEnabled":this.rootContext.mozImageSmoothingEnabled?this.smoothProperty="mozImageSmoothingEnabled":this.rootContext.oImageSmoothingEnabled?this.smoothProperty="oImageSmoothingEnabled":this.rootContext.msImageSmoothingEnabled&&(this.smoothProperty="msImageSmoothingEnabled")),this.initPlugins(e.__plugins),this.blendModes=(void 0===l&&(l=[]),h()?(l[i.BLEND_MODES.NORMAL]="source-over",l[i.BLEND_MODES.ADD]="lighter",l[i.BLEND_MODES.MULTIPLY]="multiply",l[i.BLEND_MODES.SCREEN]="screen",l[i.BLEND_MODES.OVERLAY]="overlay",l[i.BLEND_MODES.DARKEN]="darken",l[i.BLEND_MODES.LIGHTEN]="lighten",l[i.BLEND_MODES.COLOR_DODGE]="color-dodge",l[i.BLEND_MODES.COLOR_BURN]="color-burn",l[i.BLEND_MODES.HARD_LIGHT]="hard-light",l[i.BLEND_MODES.SOFT_LIGHT]="soft-light",l[i.BLEND_MODES.DIFFERENCE]="difference",l[i.BLEND_MODES.EXCLUSION]="exclusion",l[i.BLEND_MODES.HUE]="hue",l[i.BLEND_MODES.SATURATION]="saturate",l[i.BLEND_MODES.COLOR]="color",l[i.BLEND_MODES.LUMINOSITY]="luminosity"):(l[i.BLEND_MODES.NORMAL]="source-over",l[i.BLEND_MODES.ADD]="lighter",l[i.BLEND_MODES.MULTIPLY]="source-over",l[i.BLEND_MODES.SCREEN]="source-over",l[i.BLEND_MODES.OVERLAY]="source-over",l[i.BLEND_MODES.DARKEN]="source-over",l[i.BLEND_MODES.LIGHTEN]="source-over",l[i.BLEND_MODES.COLOR_DODGE]="source-over",l[i.BLEND_MODES.COLOR_BURN]="source-over",l[i.BLEND_MODES.HARD_LIGHT]="source-over",l[i.BLEND_MODES.SOFT_LIGHT]="source-over",l[i.BLEND_MODES.DIFFERENCE]="source-over",l[i.BLEND_MODES.EXCLUSION]="source-over",l[i.BLEND_MODES.HUE]="source-over",l[i.BLEND_MODES.SATURATION]="source-over",l[i.BLEND_MODES.COLOR]="source-over",l[i.BLEND_MODES.LUMINOSITY]="source-over"),l[i.BLEND_MODES.NORMAL_NPM]=l[i.BLEND_MODES.NORMAL],l[i.BLEND_MODES.ADD_NPM]=l[i.BLEND_MODES.ADD],l[i.BLEND_MODES.SCREEN_NPM]=l[i.BLEND_MODES.SCREEN],l[i.BLEND_MODES.SRC_IN]="source-in",l[i.BLEND_MODES.SRC_OUT]="source-out",l[i.BLEND_MODES.SRC_ATOP]="source-atop",l[i.BLEND_MODES.DST_OVER]="destination-over",l[i.BLEND_MODES.DST_IN]="destination-in",l[i.BLEND_MODES.DST_OUT]="destination-out",l[i.BLEND_MODES.DST_ATOP]="destination-atop",l[i.BLEND_MODES.SUBTRACT]="source-over",l),this._activeBlendMode=null,this._outerBlend=!1,this.renderingToScreen=!1,o.sayHello("Canvas"),this.resize(this.options.width,this.options.height)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.render=function(t,e,r,n,a){if(this.view){this.renderingToScreen=!e,this.emit("prerender");var s=this.resolution;e?((e=e.baseTexture||e)._canvasRenderTarget||(e._canvasRenderTarget=new o.CanvasRenderTarget(e.width,e.height,e.resolution),e.source=e._canvasRenderTarget.canvas,e.valid=!0),this.context=e._canvasRenderTarget.context,this.resolution=e._canvasRenderTarget.resolution):this.context=this.rootContext;var h=this.context;if(e||(this._lastObjectRendered=t),!a){var l=t.parent,c=this._tempDisplayObjectParent.transform.worldTransform;n?(n.copyTo(c),this._tempDisplayObjectParent.transform._worldID=-1):c.identity(),t.parent=this._tempDisplayObjectParent,t.updateTransform(),t.parent=l}h.save(),h.setTransform(1,0,0,1,0,0),h.globalAlpha=1,this._activeBlendMode=i.BLEND_MODES.NORMAL,this._outerBlend=!1,h.globalCompositeOperation=this.blendModes[i.BLEND_MODES.NORMAL],(void 0!==r?r:this.clearBeforeRender)&&this.renderingToScreen&&(this.transparent?h.clearRect(0,0,this.width,this.height):(h.fillStyle=this._backgroundColorString,h.fillRect(0,0,this.width,this.height)));var E=this.context;this.context=h,t.renderCanvas(this),this.context=E,h.restore(),this.resolution=s,this.emit("postrender")}},e.prototype.clear=function(t){var e=this.context;t=t||this._backgroundColorString,!this.transparent&&t?(e.fillStyle=t,e.fillRect(0,0,this.width,this.height)):e.clearRect(0,0,this.width,this.height)},e.prototype.setBlendMode=function(t,e){var o=t===i.BLEND_MODES.SRC_IN||t===i.BLEND_MODES.SRC_OUT||t===i.BLEND_MODES.DST_IN||t===i.BLEND_MODES.DST_ATOP;!e&&o&&(t=i.BLEND_MODES.NORMAL),this._activeBlendMode!==t&&(this._activeBlendMode=t,this._outerBlend=o,this.context.globalCompositeOperation=this.blendModes[t])},e.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},e.prototype.resize=function(e,o){t.prototype.resize.call(this,e,o),this.smoothProperty&&(this.rootContext[this.smoothProperty]=n.settings.SCALE_MODE===i.SCALE_MODES.LINEAR)},e.prototype.invalidateBlendMode=function(){this._activeBlendMode=this.blendModes.indexOf(this.context.globalCompositeOperation)},e.registerPlugin=function(t,o){e.__plugins=e.__plugins||{},e.__plugins[t]=o},e}(e.AbstractRenderer),c={getTintedCanvas:function(t,e){var o=t._texture,r="#"+("00000"+(0|(e=c.roundColor(e))).toString(16)).substr(-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=c.canvas||document.createElement("canvas");if(c.tintMethod(o,e,i),i.tintId=o._updateID,c.convertTintToImage){var a=new Image;a.src=i.toDataURL(),o.tintCache[r]=a}else o.tintCache[r]=i,c.canvas=null;return i},tintWithMultiply:function(t,e,o){var r=o.getContext("2d"),i=t._frame.clone(),n=t.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|e).toString(16)).substr(-6),r.fillRect(0,0,i.width,i.height),r.globalCompositeOperation="multiply";var a=t.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(t,e,o){var r=o.getContext("2d"),i=t._frame.clone(),n=t.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|e).toString(16)).substr(-6),r.fillRect(0,0,i.width,i.height),r.globalCompositeOperation="destination-atop",r.drawImage(t.baseTexture.getDrawableSource(),i.x,i.y,i.width,i.height,0,0,i.width,i.height),r.restore()},tintWithPerPixel:function(t,e,r){var i=r.getContext("2d"),n=t._frame.clone(),a=t.baseTexture.resolution;n.x*=a,n.y*=a,n.width*=a,n.height*=a,r.width=Math.ceil(n.width),r.height=Math.ceil(n.height),i.save(),i.globalCompositeOperation="copy",i.drawImage(t.baseTexture.getDrawableSource(),n.x,n.y,n.width,n.height,0,0,n.width,n.height),i.restore();for(var s=o.hex2rgb(e),h=s[0],l=s[1],c=s[2],E=i.getImageData(0,0,n.width,n.height),d=E.data,D=0;D<d.length;D+=4)d[D+0]*=h,d[D+1]*=l,d[D+2]*=c;i.putImageData(E,0,0)},roundColor:function(t){var e=c.cacheStepsPerColorChannel,r=o.hex2rgb(t);return r[0]=Math.min(255,r[0]/e*e),r[1]=Math.min(255,r[1]/e*e),r[2]=Math.min(255,r[2]/e*e),o.rgb2hex(r)},cacheStepsPerColorChannel:8,convertTintToImage:!1,canUseMultiply:h(),tintMethod:function(){}};c.tintMethod=c.canUseMultiply?c.tintWithMultiply:c.tintWithPerPixel;var E=e.Renderer.create;return e.Renderer.create=function(t){if(!(t&&t.forceCanvas))try{return E(t)}catch(t){}return new l(t)},e.BaseTexture.prototype.getDrawableSource=function(){var t=this.resource;return t?t.bitmap||t.source:this.source},t.CanvasRenderer=l,t.CanvasTinter=c,t.canUseNewCanvasBlendModes=h,t}({},PIXI,PIXI.utils,PIXI,PIXI,PIXI);Object.assign(this.PIXI,_pixi_canvas_renderer);
this.PIXI=this.PIXI||{};var _pixi_canvas_renderer=function(t,e,o,r,i,n){"use strict";var a=function(t){this.renderer=t};function s(t){var e=document.createElement("canvas");e.width=6,e.height=1;var o=e.getContext("2d");return o.fillStyle=t,o.fillRect(0,0,6,1),e}function h(){if("undefined"==typeof document)return!1;var t=s("#ff00ff"),e=s("#ffff00"),o=document.createElement("canvas");o.width=6,o.height=1;var r=o.getContext("2d");r.globalCompositeOperation="multiply",r.drawImage(t,0,0),r.drawImage(e,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]}a.prototype.pushMask=function(t){var e=this.renderer;e.context.save();var o=t.alpha,r=t.transform.worldTransform,i=e.resolution;e.context.setTransform(r.a*i,r.b*i,r.c*i,r.d*i,r.tx*i,r.ty*i),t._texture||(this.renderGraphicsShape(t),e.context.clip()),t.worldAlpha=o},a.prototype.renderGraphicsShape=function(t){var e=this.renderer.context,o=t.geometry.graphicsData,i=o.length;if(0!==i){e.beginPath();for(var n=0;n<i;n++){var a=o[n],s=a.shape;if(a.type===r.SHAPES.POLY){var h=s.points;e.moveTo(h[0],h[1]);for(var l=1;l<h.length/2;l++)e.lineTo(h[2*l],h[2*l+1]);h[0]===h[h.length-2]&&h[1]===h[h.length-1]&&e.closePath()}else if(a.type===r.SHAPES.RECT)e.rect(s.x,s.y,s.width,s.height),e.closePath();else if(a.type===r.SHAPES.CIRC)e.arc(s.x,s.y,s.radius,0,2*Math.PI),e.closePath();else if(a.type===r.SHAPES.ELIP){var c=2*s.width,E=2*s.height,d=s.x-c/2,D=s.y-E/2,u=c/2*.5522848,g=E/2*.5522848,p=d+c,S=D+E,_=d+c/2,O=D+E/2;e.moveTo(d,O),e.bezierCurveTo(d,O-g,_-u,D,_,D),e.bezierCurveTo(_+u,D,p,O-g,p,O),e.bezierCurveTo(p,O+g,_+u,S,_,S),e.bezierCurveTo(_-u,S,d,O+g,d,O),e.closePath()}else if(a.type===r.SHAPES.RREC){var v=s.x,M=s.y,m=s.width,N=s.height,L=s.radius,C=Math.min(m,N)/2|0;L=L>C?C:L,e.moveTo(v,M+L),e.lineTo(v,M+N-L),e.quadraticCurveTo(v,M+N,v+L,M+N),e.lineTo(v+m-L,M+N),e.quadraticCurveTo(v+m,M+N,v+m,M+N-L),e.lineTo(v+m,M+L),e.quadraticCurveTo(v+m,M,v+m-L,M),e.lineTo(v+L,M),e.quadraticCurveTo(v,M,v,M+L),e.closePath()}}}},a.prototype.popMask=function(t){t.context.restore(),t.invalidateBlendMode()},a.prototype.destroy=function(){};var l=function(t){function r(e,n,s){var l;t.call(this,"Canvas",e,n,s),this.type=i.RENDERER_TYPE.CANVAS,this.rootContext=this.view.getContext("2d",{alpha:this.transparent}),this.context=this.rootContext,this.refresh=!0,this.maskManager=new a(this),this.smoothProperty="imageSmoothingEnabled",this.rootContext.imageSmoothingEnabled||(this.rootContext.webkitImageSmoothingEnabled?this.smoothProperty="webkitImageSmoothingEnabled":this.rootContext.mozImageSmoothingEnabled?this.smoothProperty="mozImageSmoothingEnabled":this.rootContext.oImageSmoothingEnabled?this.smoothProperty="oImageSmoothingEnabled":this.rootContext.msImageSmoothingEnabled&&(this.smoothProperty="msImageSmoothingEnabled")),this.initPlugins(r.__plugins),this.blendModes=(void 0===l&&(l=[]),h()?(l[i.BLEND_MODES.NORMAL]="source-over",l[i.BLEND_MODES.ADD]="lighter",l[i.BLEND_MODES.MULTIPLY]="multiply",l[i.BLEND_MODES.SCREEN]="screen",l[i.BLEND_MODES.OVERLAY]="overlay",l[i.BLEND_MODES.DARKEN]="darken",l[i.BLEND_MODES.LIGHTEN]="lighten",l[i.BLEND_MODES.COLOR_DODGE]="color-dodge",l[i.BLEND_MODES.COLOR_BURN]="color-burn",l[i.BLEND_MODES.HARD_LIGHT]="hard-light",l[i.BLEND_MODES.SOFT_LIGHT]="soft-light",l[i.BLEND_MODES.DIFFERENCE]="difference",l[i.BLEND_MODES.EXCLUSION]="exclusion",l[i.BLEND_MODES.HUE]="hue",l[i.BLEND_MODES.SATURATION]="saturate",l[i.BLEND_MODES.COLOR]="color",l[i.BLEND_MODES.LUMINOSITY]="luminosity"):(l[i.BLEND_MODES.NORMAL]="source-over",l[i.BLEND_MODES.ADD]="lighter",l[i.BLEND_MODES.MULTIPLY]="source-over",l[i.BLEND_MODES.SCREEN]="source-over",l[i.BLEND_MODES.OVERLAY]="source-over",l[i.BLEND_MODES.DARKEN]="source-over",l[i.BLEND_MODES.LIGHTEN]="source-over",l[i.BLEND_MODES.COLOR_DODGE]="source-over",l[i.BLEND_MODES.COLOR_BURN]="source-over",l[i.BLEND_MODES.HARD_LIGHT]="source-over",l[i.BLEND_MODES.SOFT_LIGHT]="source-over",l[i.BLEND_MODES.DIFFERENCE]="source-over",l[i.BLEND_MODES.EXCLUSION]="source-over",l[i.BLEND_MODES.HUE]="source-over",l[i.BLEND_MODES.SATURATION]="source-over",l[i.BLEND_MODES.COLOR]="source-over",l[i.BLEND_MODES.LUMINOSITY]="source-over"),l[i.BLEND_MODES.NORMAL_NPM]=l[i.BLEND_MODES.NORMAL],l[i.BLEND_MODES.ADD_NPM]=l[i.BLEND_MODES.ADD],l[i.BLEND_MODES.SCREEN_NPM]=l[i.BLEND_MODES.SCREEN],l[i.BLEND_MODES.SRC_IN]="source-in",l[i.BLEND_MODES.SRC_OUT]="source-out",l[i.BLEND_MODES.SRC_ATOP]="source-atop",l[i.BLEND_MODES.DST_OVER]="destination-over",l[i.BLEND_MODES.DST_IN]="destination-in",l[i.BLEND_MODES.DST_OUT]="destination-out",l[i.BLEND_MODES.DST_ATOP]="destination-atop",l[i.BLEND_MODES.SUBTRACT]="source-over",l),this._activeBlendMode=null,this._outerBlend=!1,this.renderingToScreen=!1,o.sayHello("Canvas"),this.resize(this.options.width,this.options.height)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype.render=function(t,r,n,a,s){if(this.view){this.renderingToScreen=!r,this.emit("prerender");var h=this.resolution;r?((r=r.baseTexture||r)._canvasRenderTarget||(r._canvasRenderTarget=new o.CanvasRenderTarget(r.width,r.height,r.resolution),r.resource=new e.resources.CanvasResource(r._canvasRenderTarget.canvas),r.valid=!0),this.context=r._canvasRenderTarget.context,this.resolution=r._canvasRenderTarget.resolution):this.context=this.rootContext;var l=this.context;if(r||(this._lastObjectRendered=t),!s){var c=t.parent,E=this._tempDisplayObjectParent.transform.worldTransform;a?(a.copyTo(E),this._tempDisplayObjectParent.transform._worldID=-1):E.identity(),t.parent=this._tempDisplayObjectParent,t.updateTransform(),t.parent=c}l.save(),l.setTransform(1,0,0,1,0,0),l.globalAlpha=1,this._activeBlendMode=i.BLEND_MODES.NORMAL,this._outerBlend=!1,l.globalCompositeOperation=this.blendModes[i.BLEND_MODES.NORMAL],(void 0!==n?n:this.clearBeforeRender)&&this.renderingToScreen&&(this.transparent?l.clearRect(0,0,this.width,this.height):(l.fillStyle=this._backgroundColorString,l.fillRect(0,0,this.width,this.height)));var d=this.context;this.context=l,t.renderCanvas(this),this.context=d,l.restore(),this.resolution=h,this.emit("postrender")}},r.prototype.clear=function(t){var e=this.context;t=t||this._backgroundColorString,!this.transparent&&t?(e.fillStyle=t,e.fillRect(0,0,this.width,this.height)):e.clearRect(0,0,this.width,this.height)},r.prototype.setBlendMode=function(t,e){var o=t===i.BLEND_MODES.SRC_IN||t===i.BLEND_MODES.SRC_OUT||t===i.BLEND_MODES.DST_IN||t===i.BLEND_MODES.DST_ATOP;!e&&o&&(t=i.BLEND_MODES.NORMAL),this._activeBlendMode!==t&&(this._activeBlendMode=t,this._outerBlend=o,this.context.globalCompositeOperation=this.blendModes[t])},r.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},r.prototype.resize=function(e,o){t.prototype.resize.call(this,e,o),this.smoothProperty&&(this.rootContext[this.smoothProperty]=n.settings.SCALE_MODE===i.SCALE_MODES.LINEAR)},r.prototype.invalidateBlendMode=function(){this._activeBlendMode=this.blendModes.indexOf(this.context.globalCompositeOperation)},r.registerPlugin=function(t,e){r.__plugins=r.__plugins||{},r.__plugins[t]=e},r}(e.AbstractRenderer),c={getTintedCanvas:function(t,e){var o=t.texture,r="#"+("00000"+(0|(e=c.roundColor(e))).toString(16)).substr(-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=c.canvas||document.createElement("canvas");if(c.tintMethod(o,e,i),i.tintId=o._updateID,c.convertTintToImage){var a=new Image;a.src=i.toDataURL(),o.tintCache[r]=a}else o.tintCache[r]=i,c.canvas=null;return i},tintWithMultiply:function(t,e,o){var r=o.getContext("2d"),i=t._frame.clone(),n=t.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|e).toString(16)).substr(-6),r.fillRect(0,0,i.width,i.height),r.globalCompositeOperation="multiply";var a=t.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(t,e,o){var r=o.getContext("2d"),i=t._frame.clone(),n=t.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|e).toString(16)).substr(-6),r.fillRect(0,0,i.width,i.height),r.globalCompositeOperation="destination-atop",r.drawImage(t.baseTexture.getDrawableSource(),i.x,i.y,i.width,i.height,0,0,i.width,i.height),r.restore()},tintWithPerPixel:function(t,e,r){var i=r.getContext("2d"),n=t._frame.clone(),a=t.baseTexture.resolution;n.x*=a,n.y*=a,n.width*=a,n.height*=a,r.width=Math.ceil(n.width),r.height=Math.ceil(n.height),i.save(),i.globalCompositeOperation="copy",i.drawImage(t.baseTexture.getDrawableSource(),n.x,n.y,n.width,n.height,0,0,n.width,n.height),i.restore();for(var s=o.hex2rgb(e),h=s[0],l=s[1],c=s[2],E=i.getImageData(0,0,n.width,n.height),d=E.data,D=0;D<d.length;D+=4)d[D+0]*=h,d[D+1]*=l,d[D+2]*=c;i.putImageData(E,0,0)},roundColor:function(t){var e=c.cacheStepsPerColorChannel,r=o.hex2rgb(t);return r[0]=Math.min(255,r[0]/e*e),r[1]=Math.min(255,r[1]/e*e),r[2]=Math.min(255,r[2]/e*e),o.rgb2hex(r)},cacheStepsPerColorChannel:8,convertTintToImage:!1,canUseMultiply:h(),tintMethod:function(){}};c.tintMethod=c.canUseMultiply?c.tintWithMultiply:c.tintWithPerPixel;var E=e.Renderer.create;return e.Renderer.create=function(t){if(!(t&&t.forceCanvas))try{return E(t)}catch(t){}return new l(t)},e.BaseTexture.prototype.getDrawableSource=function(){var t=this.resource;return t?t.bitmap||t.source:this.source},t.CanvasRenderer=l,t.CanvasTinter=c,t.canUseNewCanvasBlendModes=h,t}({},PIXI,PIXI.utils,PIXI,PIXI,PIXI);Object.assign(this.PIXI,_pixi_canvas_renderer);
//# sourceMappingURL=canvas-renderer.min.js.map
/*!
* @pixi/canvas-renderer - v5.0.4
* Compiled Fri, 07 Jun 2019 17:17:49 UTC
* @pixi/canvas-renderer - v5.1.0
* Compiled Fri, 19 Jul 2019 21:54:36 UTC
*

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

*/
import { AbstractRenderer, Renderer, BaseTexture } from '@pixi/core';
import { resources, AbstractRenderer, Renderer, BaseTexture } from '@pixi/core';
import { CanvasRenderTarget, sayHello, hex2rgb, rgb2hex } from '@pixi/utils';

@@ -461,3 +461,3 @@ import { SHAPES } from '@pixi/math';

);
renderTexture.source = renderTexture._canvasRenderTarget.canvas;
renderTexture.resource = new resources.CanvasResource(renderTexture._canvasRenderTarget.canvas);
renderTexture.valid = true;

@@ -692,3 +692,3 @@ }

getTintedCanvas: function (sprite, color) {
var texture = sprite._texture;
var texture = sprite.texture;

@@ -695,0 +695,0 @@ color = CanvasTinter.roundColor(color);

/*!
* @pixi/canvas-renderer - v5.0.4
* Compiled Fri, 07 Jun 2019 17:17:49 UTC
* @pixi/canvas-renderer - v5.1.0
* Compiled Fri, 19 Jul 2019 21:54:36 UTC
*

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

);
renderTexture.source = renderTexture._canvasRenderTarget.canvas;
renderTexture.resource = new core.resources.CanvasResource(renderTexture._canvasRenderTarget.canvas);
renderTexture.valid = true;

@@ -695,3 +695,3 @@ }

getTintedCanvas: function (sprite, color) {
var texture = sprite._texture;
var texture = sprite.texture;

@@ -698,0 +698,0 @@ color = CanvasTinter.roundColor(color);

{
"name": "@pixi/canvas-renderer",
"version": "5.0.4",
"version": "5.1.0",
"main": "lib/canvas-renderer.js",

@@ -22,5 +22,2 @@ "module": "lib/canvas-renderer.es.js",

},
"scripts": {
"test": "floss --path test"
},
"files": [

@@ -31,12 +28,9 @@ "lib",

"dependencies": {
"@pixi/constants": "^5.0.4",
"@pixi/core": "^5.0.4",
"@pixi/math": "^5.0.4",
"@pixi/settings": "^5.0.4",
"@pixi/utils": "^5.0.4"
"@pixi/constants": "^5.1.0",
"@pixi/core": "^5.1.0",
"@pixi/math": "^5.1.0",
"@pixi/settings": "^5.1.0",
"@pixi/utils": "^5.1.0"
},
"devDependencies": {
"floss": "^2.2.0"
},
"gitHead": "7a771ca5f05eeba62222b53446d0c2bdfcac37f7"
"gitHead": "05c5e0e0beba56e886c74f201bf7efe576612570"
}

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc