Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pixi/canvas-graphics

Package Overview
Dependencies
Maintainers
1
Versions
121
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixi/canvas-graphics - npm Package Compare versions

Comparing version 5.3.0 to 5.3.1

13

dist/canvas-graphics.js
/*!
* @pixi/canvas-graphics - v5.3.0
* Compiled Thu, 18 Jun 2020 23:27:40 UTC
* @pixi/canvas-graphics - v5.3.1
* Compiled Fri, 24 Jul 2020 20:56:48 UTC
*

@@ -37,2 +37,3 @@ * @pixi/canvas-graphics is licensed under the MIT License.

this._svgMatrix = null;
this._tempMatrix = new math.Matrix();
}

@@ -88,2 +89,5 @@ /**

var lineColor = data.lineStyle.color | 0;
if (data.matrix) {
renderer.setContextTransform(transform.copyTo(this._tempMatrix).append(data.matrix));
}
if (fillStyle.visible) {

@@ -292,2 +296,4 @@ var fillTint = ((((fillColor >> 16) & 0xFF) / 255 * tintR * 255 << 16)

this.renderer = null;
this._svgMatrix = null;
this._tempMatrix = null;
};

@@ -329,4 +335,3 @@ return CanvasGraphicsRenderer;

});
texture.baseTexture.resolution = resolution;
texture.baseTexture.update();
texture.baseTexture.setResolution(resolution);
return texture;

@@ -333,0 +338,0 @@ };

/*!
* @pixi/canvas-graphics - v5.3.0
* Compiled Thu, 18 Jun 2020 23:27:40 UTC
* @pixi/canvas-graphics - v5.3.1
* Compiled Fri, 24 Jul 2020 20:56:48 UTC
*

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

*/
this.PIXI=this.PIXI||{};var _pixi_canvas_graphics=function(e,t,i,a,r){"use strict";var l,s=function(){function e(e){this.renderer=e,this._svgMatrix=null}return e.prototype._calcCanvasStyle=function(e,a){var r;return e.texture?e.texture.valid?(r=i.canvasUtils.getTintedPattern(e.texture,a),this.setPatternTransform(r,e.matrix||t.Matrix.IDENTITY)):r="#808080":r="#"+("00000"+(0|a).toString(16)).substr(-6),r},e.prototype.render=function(e){var i=this.renderer,a=i.context,r=e.worldAlpha,l=e.transform.worldTransform;i.setContextTransform(l),i.setBlendMode(e.blendMode);for(var s,o,n=e.geometry.graphicsData,h=(e.tint>>16&255)/255,v=(e.tint>>8&255)/255,c=(255&e.tint)/255,p=0;p<n.length;p++){var g=n[p],f=g.shape,d=g.fillStyle,u=g.lineStyle,y=0|g.fillStyle.color,T=0|g.lineStyle.color;if(d.visible){var x=((y>>16&255)/255*h*255<<16)+((y>>8&255)/255*v*255<<8)+(255&y)/255*c*255;s=this._calcCanvasStyle(d,x)}if(u.visible){var b=((T>>16&255)/255*h*255<<16)+((T>>8&255)/255*v*255<<8)+(255&T)/255*c*255;o=this._calcCanvasStyle(u,b)}if(a.lineWidth=u.width,a.lineCap=u.cap,a.lineJoin=u.join,a.miterLimit=u.miterLimit,g.type===t.SHAPES.POLY){a.beginPath();var S=(w=f).points,P=g.holes,m=void 0,M=void 0,_=void 0,C=void 0;a.moveTo(S[0],S[1]);for(var I=2;I<S.length;I+=2)a.lineTo(S[I],S[I+1]);if(w.closeStroke&&a.closePath(),P.length>0){m=0,_=S[0],C=S[1];for(I=2;I+2<S.length;I+=2)m+=(S[I]-_)*(S[I+3]-C)-(S[I+2]-_)*(S[I+1]-C);for(var A=0;A<P.length;A++)if(S=P[A].shape.points){M=0,_=S[0],C=S[1];for(I=2;I+2<S.length;I+=2)M+=(S[I]-_)*(S[I+3]-C)-(S[I+2]-_)*(S[I+1]-C);if(M*m<0){a.moveTo(S[0],S[1]);for(I=2;I<S.length;I+=2)a.lineTo(S[I],S[I+1])}else{a.moveTo(S[S.length-2],S[S.length-1]);for(I=S.length-4;I>=0;I-=2)a.lineTo(S[I],S[I+1])}P[A].shape.closeStroke&&a.closePath()}}d.visible&&(a.globalAlpha=d.alpha*r,a.fillStyle=s,a.fill()),u.visible&&(a.globalAlpha=u.alpha*r,a.strokeStyle=o,a.stroke())}else if(g.type===t.SHAPES.RECT){var w=f;d.visible&&(a.globalAlpha=d.alpha*r,a.fillStyle=s,a.fillRect(w.x,w.y,w.width,w.height)),u.visible&&(a.globalAlpha=u.alpha*r,a.strokeStyle=o,a.strokeRect(w.x,w.y,w.width,w.height))}else if(g.type===t.SHAPES.CIRC){w=f;a.beginPath(),a.arc(w.x,w.y,w.radius,0,2*Math.PI),a.closePath(),d.visible&&(a.globalAlpha=d.alpha*r,a.fillStyle=s,a.fill()),u.visible&&(a.globalAlpha=u.alpha*r,a.strokeStyle=o,a.stroke())}else if(g.type===t.SHAPES.ELIP){var k=2*(w=f).width,E=2*w.height,R=w.x-k/2,G=w.y-E/2;a.beginPath();var X=k/2*.5522848,L=E/2*.5522848,H=R+k,q=G+E,z=R+k/2,D=G+E/2;a.moveTo(R,D),a.bezierCurveTo(R,D-L,z-X,G,z,G),a.bezierCurveTo(z+X,G,H,D-L,H,D),a.bezierCurveTo(H,D+L,z+X,q,z,q),a.bezierCurveTo(z-X,q,R,D+L,R,D),a.closePath(),d.visible&&(a.globalAlpha=d.alpha*r,a.fillStyle=s,a.fill()),u.visible&&(a.globalAlpha=u.alpha*r,a.strokeStyle=o,a.stroke())}else if(g.type===t.SHAPES.RREC){var j=(w=f).x,B=w.y,N=w.width,O=w.height,V=w.radius,Y=Math.min(N,O)/2|0;V=V>Y?Y:V,a.beginPath(),a.moveTo(j,B+V),a.lineTo(j,B+O-V),a.quadraticCurveTo(j,B+O,j+V,B+O),a.lineTo(j+N-V,B+O),a.quadraticCurveTo(j+N,B+O,j+N,B+O-V),a.lineTo(j+N,B+V),a.quadraticCurveTo(j+N,B,j+N-V,B),a.lineTo(j+V,B),a.quadraticCurveTo(j,B,j,B+V),a.closePath(),d.visible&&(a.globalAlpha=d.alpha*r,a.fillStyle=s,a.fill()),u.visible&&(a.globalAlpha=u.alpha*r,a.strokeStyle=o,a.stroke())}}},e.prototype.setPatternTransform=function(e,t){if(!1!==this._svgMatrix){if(!this._svgMatrix){var i=document.createElementNS("http://www.w3.org/2000/svg","svg");if(i&&i.createSVGMatrix&&(this._svgMatrix=i.createSVGMatrix()),!this._svgMatrix||!e.setTransform)return void(this._svgMatrix=!1)}this._svgMatrix.a=t.a,this._svgMatrix.b=t.b,this._svgMatrix.c=t.c,this._svgMatrix.d=t.d,this._svgMatrix.e=t.tx,this._svgMatrix.f=t.ty,e.setTransform(this._svgMatrix.inverse())}},e.prototype.destroy=function(){this.renderer=null},e}(),o=new t.Matrix;return a.Graphics.prototype.generateCanvasTexture=function(e,t){void 0===t&&(t=1);var a=this.getLocalBounds(),s=r.RenderTexture.create({width:a.width,height:a.height,scaleMode:e,resolution:t});l||(l=new i.CanvasRenderer),this.transform.updateLocalTransform(),this.transform.localTransform.copyTo(o),o.invert(),o.tx-=a.x,o.ty-=a.y,l.render(this,s,!0,o);var n=r.Texture.from(s.baseTexture._canvasRenderTarget.canvas,{scaleMode:e});return n.baseTexture.resolution=t,n.baseTexture.update(),n},a.Graphics.prototype.cachedGraphicsData=[],a.Graphics.prototype._renderCanvas=function(e){!0!==this.isMask&&(this.finishPoly(),e.plugins.graphics.render(this))},e.CanvasGraphicsRenderer=s,e}({},PIXI,PIXI,PIXI,PIXI);Object.assign(this.PIXI,_pixi_canvas_graphics);
this.PIXI=this.PIXI||{};var _pixi_canvas_graphics=function(t,e,i,a,r){"use strict";var l,s=function(){function t(t){this.renderer=t,this._svgMatrix=null,this._tempMatrix=new e.Matrix}return t.prototype._calcCanvasStyle=function(t,a){var r;return t.texture?t.texture.valid?(r=i.canvasUtils.getTintedPattern(t.texture,a),this.setPatternTransform(r,t.matrix||e.Matrix.IDENTITY)):r="#808080":r="#"+("00000"+(0|a).toString(16)).substr(-6),r},t.prototype.render=function(t){var i=this.renderer,a=i.context,r=t.worldAlpha,l=t.transform.worldTransform;i.setContextTransform(l),i.setBlendMode(t.blendMode);for(var s,o,n=t.geometry.graphicsData,h=(t.tint>>16&255)/255,v=(t.tint>>8&255)/255,p=(255&t.tint)/255,c=0;c<n.length;c++){var g=n[c],f=g.shape,d=g.fillStyle,u=g.lineStyle,x=0|g.fillStyle.color,y=0|g.lineStyle.color;if(g.matrix&&i.setContextTransform(l.copyTo(this._tempMatrix).append(g.matrix)),d.visible){var T=((x>>16&255)/255*h*255<<16)+((x>>8&255)/255*v*255<<8)+(255&x)/255*p*255;s=this._calcCanvasStyle(d,T)}if(u.visible){var b=((y>>16&255)/255*h*255<<16)+((y>>8&255)/255*v*255<<8)+(255&y)/255*p*255;o=this._calcCanvasStyle(u,b)}if(a.lineWidth=u.width,a.lineCap=u.cap,a.lineJoin=u.join,a.miterLimit=u.miterLimit,g.type===e.SHAPES.POLY){a.beginPath();var S=(A=f).points,m=g.holes,M=void 0,P=void 0,_=void 0,C=void 0;a.moveTo(S[0],S[1]);for(var I=2;I<S.length;I+=2)a.lineTo(S[I],S[I+1]);if(A.closeStroke&&a.closePath(),m.length>0){M=0,_=S[0],C=S[1];for(I=2;I+2<S.length;I+=2)M+=(S[I]-_)*(S[I+3]-C)-(S[I+2]-_)*(S[I+1]-C);for(var w=0;w<m.length;w++)if(S=m[w].shape.points){P=0,_=S[0],C=S[1];for(I=2;I+2<S.length;I+=2)P+=(S[I]-_)*(S[I+3]-C)-(S[I+2]-_)*(S[I+1]-C);if(P*M<0){a.moveTo(S[0],S[1]);for(I=2;I<S.length;I+=2)a.lineTo(S[I],S[I+1])}else{a.moveTo(S[S.length-2],S[S.length-1]);for(I=S.length-4;I>=0;I-=2)a.lineTo(S[I],S[I+1])}m[w].shape.closeStroke&&a.closePath()}}d.visible&&(a.globalAlpha=d.alpha*r,a.fillStyle=s,a.fill()),u.visible&&(a.globalAlpha=u.alpha*r,a.strokeStyle=o,a.stroke())}else if(g.type===e.SHAPES.RECT){var A=f;d.visible&&(a.globalAlpha=d.alpha*r,a.fillStyle=s,a.fillRect(A.x,A.y,A.width,A.height)),u.visible&&(a.globalAlpha=u.alpha*r,a.strokeStyle=o,a.strokeRect(A.x,A.y,A.width,A.height))}else if(g.type===e.SHAPES.CIRC){A=f;a.beginPath(),a.arc(A.x,A.y,A.radius,0,2*Math.PI),a.closePath(),d.visible&&(a.globalAlpha=d.alpha*r,a.fillStyle=s,a.fill()),u.visible&&(a.globalAlpha=u.alpha*r,a.strokeStyle=o,a.stroke())}else if(g.type===e.SHAPES.ELIP){var k=2*(A=f).width,R=2*A.height,E=A.x-k/2,G=A.y-R/2;a.beginPath();var X=k/2*.5522848,L=R/2*.5522848,H=E+k,q=G+R,z=E+k/2,D=G+R/2;a.moveTo(E,D),a.bezierCurveTo(E,D-L,z-X,G,z,G),a.bezierCurveTo(z+X,G,H,D-L,H,D),a.bezierCurveTo(H,D+L,z+X,q,z,q),a.bezierCurveTo(z-X,q,E,D+L,E,D),a.closePath(),d.visible&&(a.globalAlpha=d.alpha*r,a.fillStyle=s,a.fill()),u.visible&&(a.globalAlpha=u.alpha*r,a.strokeStyle=o,a.stroke())}else if(g.type===e.SHAPES.RREC){var j=(A=f).x,B=A.y,N=A.width,O=A.height,V=A.radius,Y=Math.min(N,O)/2|0;V=V>Y?Y:V,a.beginPath(),a.moveTo(j,B+V),a.lineTo(j,B+O-V),a.quadraticCurveTo(j,B+O,j+V,B+O),a.lineTo(j+N-V,B+O),a.quadraticCurveTo(j+N,B+O,j+N,B+O-V),a.lineTo(j+N,B+V),a.quadraticCurveTo(j+N,B,j+N-V,B),a.lineTo(j+V,B),a.quadraticCurveTo(j,B,j,B+V),a.closePath(),d.visible&&(a.globalAlpha=d.alpha*r,a.fillStyle=s,a.fill()),u.visible&&(a.globalAlpha=u.alpha*r,a.strokeStyle=o,a.stroke())}}},t.prototype.setPatternTransform=function(t,e){if(!1!==this._svgMatrix){if(!this._svgMatrix){var i=document.createElementNS("http://www.w3.org/2000/svg","svg");if(i&&i.createSVGMatrix&&(this._svgMatrix=i.createSVGMatrix()),!this._svgMatrix||!t.setTransform)return void(this._svgMatrix=!1)}this._svgMatrix.a=e.a,this._svgMatrix.b=e.b,this._svgMatrix.c=e.c,this._svgMatrix.d=e.d,this._svgMatrix.e=e.tx,this._svgMatrix.f=e.ty,t.setTransform(this._svgMatrix.inverse())}},t.prototype.destroy=function(){this.renderer=null,this._svgMatrix=null,this._tempMatrix=null},t}(),o=new e.Matrix;return a.Graphics.prototype.generateCanvasTexture=function(t,e){void 0===e&&(e=1);var a=this.getLocalBounds(),s=r.RenderTexture.create({width:a.width,height:a.height,scaleMode:t,resolution:e});l||(l=new i.CanvasRenderer),this.transform.updateLocalTransform(),this.transform.localTransform.copyTo(o),o.invert(),o.tx-=a.x,o.ty-=a.y,l.render(this,s,!0,o);var n=r.Texture.from(s.baseTexture._canvasRenderTarget.canvas,{scaleMode:t});return n.baseTexture.setResolution(e),n},a.Graphics.prototype.cachedGraphicsData=[],a.Graphics.prototype._renderCanvas=function(t){!0!==this.isMask&&(this.finishPoly(),t.plugins.graphics.render(this))},t.CanvasGraphicsRenderer=s,t}({},PIXI,PIXI,PIXI,PIXI);Object.assign(this.PIXI,_pixi_canvas_graphics);
//# sourceMappingURL=canvas-graphics.min.js.map
/*!
* @pixi/canvas-graphics - v5.3.0
* Compiled Thu, 18 Jun 2020 23:27:40 UTC
* @pixi/canvas-graphics - v5.3.1
* Compiled Fri, 24 Jul 2020 20:56:48 UTC
*

@@ -38,2 +38,3 @@ * @pixi/canvas-graphics is licensed under the MIT License.

this._svgMatrix = null;
this._tempMatrix = new Matrix();
}

@@ -89,2 +90,5 @@ /**

var lineColor = data.lineStyle.color | 0;
if (data.matrix) {
renderer.setContextTransform(transform.copyTo(this._tempMatrix).append(data.matrix));
}
if (fillStyle.visible) {

@@ -293,2 +297,4 @@ var fillTint = ((((fillColor >> 16) & 0xFF) / 255 * tintR * 255 << 16)

this.renderer = null;
this._svgMatrix = null;
this._tempMatrix = null;
};

@@ -330,4 +336,3 @@ return CanvasGraphicsRenderer;

});
texture.baseTexture.resolution = resolution;
texture.baseTexture.update();
texture.baseTexture.setResolution(resolution);
return texture;

@@ -334,0 +339,0 @@ };

/*!
* @pixi/canvas-graphics - v5.3.0
* Compiled Thu, 18 Jun 2020 23:27:40 UTC
* @pixi/canvas-graphics - v5.3.1
* Compiled Fri, 24 Jul 2020 20:56:48 UTC
*

@@ -42,2 +42,3 @@ * @pixi/canvas-graphics is licensed under the MIT License.

this._svgMatrix = null;
this._tempMatrix = new math.Matrix();
}

@@ -93,2 +94,5 @@ /**

var lineColor = data.lineStyle.color | 0;
if (data.matrix) {
renderer.setContextTransform(transform.copyTo(this._tempMatrix).append(data.matrix));
}
if (fillStyle.visible) {

@@ -297,2 +301,4 @@ var fillTint = ((((fillColor >> 16) & 0xFF) / 255 * tintR * 255 << 16)

this.renderer = null;
this._svgMatrix = null;
this._tempMatrix = null;
};

@@ -334,4 +340,3 @@ return CanvasGraphicsRenderer;

});
texture.baseTexture.resolution = resolution;
texture.baseTexture.update();
texture.baseTexture.setResolution(resolution);
return texture;

@@ -338,0 +343,0 @@ };

{
"name": "@pixi/canvas-graphics",
"version": "5.3.0",
"version": "5.3.1",
"main": "lib/canvas-graphics.js",

@@ -27,9 +27,9 @@ "module": "lib/canvas-graphics.es.js",

"dependencies": {
"@pixi/canvas-renderer": "5.3.0",
"@pixi/constants": "5.3.0",
"@pixi/core": "5.3.0",
"@pixi/graphics": "5.3.0",
"@pixi/math": "5.3.0"
"@pixi/canvas-renderer": "5.3.1",
"@pixi/constants": "5.3.1",
"@pixi/core": "5.3.1",
"@pixi/graphics": "5.3.1",
"@pixi/math": "5.3.1"
},
"gitHead": "a9b7b32a9c0aeb3d9c42ef04b2c2a39be1cd0880"
"gitHead": "2aa5682f945df0bffc9559caeda4ba765f7f8d31"
}

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