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.2.4 to 5.2.5

8

dist/canvas-graphics.js
/*!
* @pixi/canvas-graphics - v5.2.4
* Compiled Sun, 03 May 2020 22:38:52 UTC
* @pixi/canvas-graphics - v5.2.5
* Compiled Fri, 11 Dec 2020 20:33:02 UTC
*

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

this.PIXI = this.PIXI || {};
var _pixi_canvas_graphics = (function (exports, math, canvasRenderer$1, graphics, core) {
var _pixi_canvas_graphics = (function (exports, core, math, canvasRenderer$1, graphics) {
'use strict';

@@ -50,3 +50,3 @@

if (style.texture)
if (style.texture && style.texture.baseTexture !== core.Texture.WHITE.baseTexture)
{

@@ -53,0 +53,0 @@ if (style.texture.valid)

/*!
* @pixi/canvas-graphics - v5.2.4
* Compiled Sun, 03 May 2020 22:38:52 UTC
* @pixi/canvas-graphics - v5.2.5
* Compiled Fri, 11 Dec 2020 20:33:02 UTC
*

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

*/
this.PIXI=this.PIXI||{};var _pixi_canvas_graphics=function(t,e,i,r,a){"use strict";var l,s=function(t){this.renderer=t,this._svgMatrix=null};s.prototype._calcCanvasStyle=function(t,r){var a;return t.texture?t.texture.valid?(a=i.canvasUtils.getTintedPattern(t.texture,r),this.setPatternTransform(a,t.matrix||e.Matrix.IDENTITY)):a="#808080":a="#"+("00000"+(0|r).toString(16)).substr(-6),a},s.prototype.render=function(t){var i=this.renderer,r=i.context,a=t.worldAlpha,l=t.transform.worldTransform;i.setContextTransform(l),t.canvasTintDirty===t.geometry.dirty&&t._prevTint===t.tint||this.updateGraphicsTint(t),i.setBlendMode(t.blendMode);for(var s,o,n=t.geometry.graphicsData,h=0;h<n.length;h++){var v=n[h],p=v.shape,c=v.fillStyle,g=v.lineStyle;if(c.visible&&(s=this._calcCanvasStyle(c,v._fillTint)),g.visible&&(o=this._calcCanvasStyle(g,v._lineTint)),r.lineWidth=g.width,v.type===e.SHAPES.POLY){r.beginPath();var f=p.points,d=v.holes,T=void 0,y=void 0,u=void 0,x=void 0;r.moveTo(f[0],f[1]);for(var b=2;b<f.length;b+=2)r.lineTo(f[b],f[b+1]);if(p.closeStroke&&r.closePath(),d.length>0){T=0,u=f[0],x=f[1];for(var S=2;S+2<f.length;S+=2)T+=(f[S]-u)*(f[S+3]-x)-(f[S+2]-u)*(f[S+1]-x);for(var _=0;_<d.length;_++)if(f=d[_].shape.points){y=0,u=f[0],x=f[1];for(var P=2;P+2<f.length;P+=2)y+=(f[P]-u)*(f[P+3]-x)-(f[P+2]-u)*(f[P+1]-x);if(y*T<0){r.moveTo(f[0],f[1]);for(var m=2;m<f.length;m+=2)r.lineTo(f[m],f[m+1])}else{r.moveTo(f[f.length-2],f[f.length-1]);for(var M=f.length-4;M>=0;M-=2)r.lineTo(f[M],f[M+1])}d[_].shape.closeStroke&&r.closePath()}}c.visible&&(r.globalAlpha=c.alpha*a,r.fillStyle=s,r.fill()),g.visible&&(r.globalAlpha=g.alpha*a,r.strokeStyle=o,r.stroke())}else if(v.type===e.SHAPES.RECT)c.visible&&(r.globalAlpha=c.alpha*a,r.fillStyle=s,r.fillRect(p.x,p.y,p.width,p.height)),g.visible&&(r.globalAlpha=g.alpha*a,r.strokeStyle=o,r.strokeRect(p.x,p.y,p.width,p.height));else if(v.type===e.SHAPES.CIRC)r.beginPath(),r.arc(p.x,p.y,p.radius,0,2*Math.PI),r.closePath(),c.visible&&(r.globalAlpha=c.alpha*a,r.fillStyle=s,r.fill()),g.visible&&(r.globalAlpha=g.alpha*a,r.strokeStyle=o,r.stroke());else if(v.type===e.SHAPES.ELIP){var C=2*p.width,I=2*p.height,A=p.x-C/2,w=p.y-I/2;r.beginPath();var k=C/2*.5522848,E=I/2*.5522848,R=A+C,G=w+I,X=A+C/2,D=w+I/2;r.moveTo(A,D),r.bezierCurveTo(A,D-E,X-k,w,X,w),r.bezierCurveTo(X+k,w,R,D-E,R,D),r.bezierCurveTo(R,D+E,X+k,G,X,G),r.bezierCurveTo(X-k,G,A,D+E,A,D),r.closePath(),c.visible&&(r.globalAlpha=c.alpha*a,r.fillStyle=s,r.fill()),g.visible&&(r.globalAlpha=g.alpha*a,r.strokeStyle=o,r.stroke())}else if(v.type===e.SHAPES.RREC){var H=p.x,q=p.y,z=p.width,L=p.height,B=p.radius,N=Math.min(z,L)/2|0;B=B>N?N:B,r.beginPath(),r.moveTo(H,q+B),r.lineTo(H,q+L-B),r.quadraticCurveTo(H,q+L,H+B,q+L),r.lineTo(H+z-B,q+L),r.quadraticCurveTo(H+z,q+L,H+z,q+L-B),r.lineTo(H+z,q+B),r.quadraticCurveTo(H+z,q,H+z-B,q),r.lineTo(H+B,q),r.quadraticCurveTo(H,q,H,q+B),r.closePath(),c.visible&&(r.globalAlpha=c.alpha*a,r.fillStyle=s,r.fill()),g.visible&&(r.globalAlpha=g.alpha*a,r.strokeStyle=o,r.stroke())}}},s.prototype.updateGraphicsTint=function(t){t._prevTint=t.tint,t.canvasTintDirty=t.geometry.dirty;for(var e=(t.tint>>16&255)/255,i=(t.tint>>8&255)/255,r=(255&t.tint)/255,a=t.geometry.graphicsData,l=0;l<a.length;++l){var s=a[l],o=0|s.fillStyle.color,n=0|s.lineStyle.color;s._fillTint=((o>>16&255)/255*e*255<<16)+((o>>8&255)/255*i*255<<8)+(255&o)/255*r*255,s._lineTint=((n>>16&255)/255*e*255<<16)+((n>>8&255)/255*i*255<<8)+(255&n)/255*r*255}},s.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())}},s.prototype.destroy=function(){this.renderer=null};var o=new e.Matrix;return r.Graphics.prototype.generateCanvasTexture=function(t,e){void 0===e&&(e=1);var r=this.getLocalBounds(),s=a.RenderTexture.create(r.width,r.height,t,e);l||(l=new i.CanvasRenderer),this.transform.updateLocalTransform(),this.transform.localTransform.copyTo(o),o.invert(),o.tx-=r.x,o.ty-=r.y,l.render(this,s,!0,o);var n=a.Texture.from(s.baseTexture._canvasRenderTarget.canvas,{scaleMode:t});return n.baseTexture.resolution=e,n.baseTexture.update(),n},r.Graphics.prototype.cachedGraphicsData=[],r.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);
this.PIXI=this.PIXI||{};var _pixi_canvas_graphics=function(e,t,i,r,a){"use strict";var l,s=function(e){this.renderer=e,this._svgMatrix=null};s.prototype._calcCanvasStyle=function(e,a){var l;return e.texture&&e.texture.baseTexture!==t.Texture.WHITE.baseTexture?e.texture.valid?(l=r.canvasUtils.getTintedPattern(e.texture,a),this.setPatternTransform(l,e.matrix||i.Matrix.IDENTITY)):l="#808080":l="#"+("00000"+(0|a).toString(16)).substr(-6),l},s.prototype.render=function(e){var t=this.renderer,r=t.context,a=e.worldAlpha,l=e.transform.worldTransform;t.setContextTransform(l),e.canvasTintDirty===e.geometry.dirty&&e._prevTint===e.tint||this.updateGraphicsTint(e),t.setBlendMode(e.blendMode);for(var s,o,n=e.geometry.graphicsData,h=0;h<n.length;h++){var v=n[h],p=v.shape,c=v.fillStyle,g=v.lineStyle;if(c.visible&&(s=this._calcCanvasStyle(c,v._fillTint)),g.visible&&(o=this._calcCanvasStyle(g,v._lineTint)),r.lineWidth=g.width,v.type===i.SHAPES.POLY){r.beginPath();var f=p.points,T=v.holes,u=void 0,d=void 0,y=void 0,x=void 0;r.moveTo(f[0],f[1]);for(var b=2;b<f.length;b+=2)r.lineTo(f[b],f[b+1]);if(p.closeStroke&&r.closePath(),T.length>0){u=0,y=f[0],x=f[1];for(var S=2;S+2<f.length;S+=2)u+=(f[S]-y)*(f[S+3]-x)-(f[S+2]-y)*(f[S+1]-x);for(var _=0;_<T.length;_++)if(f=T[_].shape.points){d=0,y=f[0],x=f[1];for(var P=2;P+2<f.length;P+=2)d+=(f[P]-y)*(f[P+3]-x)-(f[P+2]-y)*(f[P+1]-x);if(d*u<0){r.moveTo(f[0],f[1]);for(var m=2;m<f.length;m+=2)r.lineTo(f[m],f[m+1])}else{r.moveTo(f[f.length-2],f[f.length-1]);for(var M=f.length-4;M>=0;M-=2)r.lineTo(f[M],f[M+1])}T[_].shape.closeStroke&&r.closePath()}}c.visible&&(r.globalAlpha=c.alpha*a,r.fillStyle=s,r.fill()),g.visible&&(r.globalAlpha=g.alpha*a,r.strokeStyle=o,r.stroke())}else if(v.type===i.SHAPES.RECT)c.visible&&(r.globalAlpha=c.alpha*a,r.fillStyle=s,r.fillRect(p.x,p.y,p.width,p.height)),g.visible&&(r.globalAlpha=g.alpha*a,r.strokeStyle=o,r.strokeRect(p.x,p.y,p.width,p.height));else if(v.type===i.SHAPES.CIRC)r.beginPath(),r.arc(p.x,p.y,p.radius,0,2*Math.PI),r.closePath(),c.visible&&(r.globalAlpha=c.alpha*a,r.fillStyle=s,r.fill()),g.visible&&(r.globalAlpha=g.alpha*a,r.strokeStyle=o,r.stroke());else if(v.type===i.SHAPES.ELIP){var C=2*p.width,I=2*p.height,A=p.x-C/2,w=p.y-I/2;r.beginPath();var k=C/2*.5522848,E=I/2*.5522848,R=A+C,G=w+I,X=A+C/2,D=w+I/2;r.moveTo(A,D),r.bezierCurveTo(A,D-E,X-k,w,X,w),r.bezierCurveTo(X+k,w,R,D-E,R,D),r.bezierCurveTo(R,D+E,X+k,G,X,G),r.bezierCurveTo(X-k,G,A,D+E,A,D),r.closePath(),c.visible&&(r.globalAlpha=c.alpha*a,r.fillStyle=s,r.fill()),g.visible&&(r.globalAlpha=g.alpha*a,r.strokeStyle=o,r.stroke())}else if(v.type===i.SHAPES.RREC){var H=p.x,q=p.y,z=p.width,L=p.height,B=p.radius,N=Math.min(z,L)/2|0;B=B>N?N:B,r.beginPath(),r.moveTo(H,q+B),r.lineTo(H,q+L-B),r.quadraticCurveTo(H,q+L,H+B,q+L),r.lineTo(H+z-B,q+L),r.quadraticCurveTo(H+z,q+L,H+z,q+L-B),r.lineTo(H+z,q+B),r.quadraticCurveTo(H+z,q,H+z-B,q),r.lineTo(H+B,q),r.quadraticCurveTo(H,q,H,q+B),r.closePath(),c.visible&&(r.globalAlpha=c.alpha*a,r.fillStyle=s,r.fill()),g.visible&&(r.globalAlpha=g.alpha*a,r.strokeStyle=o,r.stroke())}}},s.prototype.updateGraphicsTint=function(e){e._prevTint=e.tint,e.canvasTintDirty=e.geometry.dirty;for(var t=(e.tint>>16&255)/255,i=(e.tint>>8&255)/255,r=(255&e.tint)/255,a=e.geometry.graphicsData,l=0;l<a.length;++l){var s=a[l],o=0|s.fillStyle.color,n=0|s.lineStyle.color;s._fillTint=((o>>16&255)/255*t*255<<16)+((o>>8&255)/255*i*255<<8)+(255&o)/255*r*255,s._lineTint=((n>>16&255)/255*t*255<<16)+((n>>8&255)/255*i*255<<8)+(255&n)/255*r*255}},s.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())}},s.prototype.destroy=function(){this.renderer=null};var o=new i.Matrix;return a.Graphics.prototype.generateCanvasTexture=function(e,i){void 0===i&&(i=1);var a=this.getLocalBounds(),s=t.RenderTexture.create(a.width,a.height,e,i);l||(l=new r.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=t.Texture.from(s.baseTexture._canvasRenderTarget.canvas,{scaleMode:e});return n.baseTexture.resolution=i,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);
//# sourceMappingURL=canvas-graphics.min.js.map
/*!
* @pixi/canvas-graphics - v5.2.4
* Compiled Sun, 03 May 2020 22:38:52 UTC
* @pixi/canvas-graphics - v5.2.5
* Compiled Fri, 11 Dec 2020 20:33:02 UTC
*

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

*/
import { Texture, RenderTexture } from '@pixi/core';
import { Matrix, SHAPES } from '@pixi/math';
import { canvasUtils, CanvasRenderer } from '@pixi/canvas-renderer';
import { Graphics } from '@pixi/graphics';
import { RenderTexture, Texture } from '@pixi/core';

@@ -51,3 +51,3 @@ /**

if (style.texture)
if (style.texture && style.texture.baseTexture !== Texture.WHITE.baseTexture)
{

@@ -54,0 +54,0 @@ if (style.texture.valid)

/*!
* @pixi/canvas-graphics - v5.2.4
* Compiled Sun, 03 May 2020 22:38:52 UTC
* @pixi/canvas-graphics - v5.2.5
* Compiled Fri, 11 Dec 2020 20:33:02 UTC
*

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

var core = require('@pixi/core');
var math = require('@pixi/math');
var canvasRenderer$1 = require('@pixi/canvas-renderer');
var graphics = require('@pixi/graphics');
var core = require('@pixi/core');

@@ -55,3 +55,3 @@ /**

if (style.texture)
if (style.texture && style.texture.baseTexture !== core.Texture.WHITE.baseTexture)
{

@@ -58,0 +58,0 @@ if (style.texture.valid)

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

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

"dependencies": {
"@pixi/canvas-renderer": "5.2.4",
"@pixi/core": "5.2.4",
"@pixi/graphics": "5.2.4",
"@pixi/math": "5.2.4"
"@pixi/canvas-renderer": "5.2.5",
"@pixi/core": "5.2.5",
"@pixi/graphics": "5.2.5",
"@pixi/math": "5.2.5"
},
"gitHead": "71c6b3b2061af4a4f3a95a265d46e933b8befc2c"
"gitHead": "e667506ebb663dce9cb4c218daa11489cb089f91"
}

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