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.3 to 5.3.4

8

dist/canvas-graphics.js
/*!
* @pixi/canvas-graphics - v5.3.3
* Compiled Tue, 04 Aug 2020 16:23:09 UTC
* @pixi/canvas-graphics - v5.3.4
* Compiled Mon, 14 Dec 2020 19:48:09 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 @@

var res;
if (style.texture) {
if (style.texture && style.texture.baseTexture !== core.Texture.WHITE.baseTexture) {
if (style.texture.valid) {

@@ -53,0 +53,0 @@ res = canvasRenderer$1.canvasUtils.getTintedPattern(style.texture, tint);

/*!
* @pixi/canvas-graphics - v5.3.3
* Compiled Tue, 04 Aug 2020 16:23:09 UTC
* @pixi/canvas-graphics - v5.3.4
* Compiled Mon, 14 Dec 2020 19:48:09 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,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);
this.PIXI=this.PIXI||{};var _pixi_canvas_graphics=function(e,t,i,r,a){"use strict";var l,s=function(){function e(e){this.renderer=e,this._svgMatrix=null,this._tempMatrix=new i.Matrix}return e.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},e.prototype.render=function(e){var t=this.renderer,r=t.context,a=e.worldAlpha,l=e.transform.worldTransform;t.setContextTransform(l),t.setBlendMode(e.blendMode);for(var s,o,n=e.geometry.graphicsData,h=(e.tint>>16&255)/255,v=(e.tint>>8&255)/255,p=(255&e.tint)/255,c=0;c<n.length;c++){var g=n[c],f=g.shape,u=g.fillStyle,x=g.lineStyle,d=0|g.fillStyle.color,T=0|g.lineStyle.color;if(g.matrix&&t.setContextTransform(l.copyTo(this._tempMatrix).append(g.matrix)),u.visible){var y=((d>>16&255)/255*h*255<<16)+((d>>8&255)/255*v*255<<8)+(255&d)/255*p*255;s=this._calcCanvasStyle(u,y)}if(x.visible){var b=((T>>16&255)/255*h*255<<16)+((T>>8&255)/255*v*255<<8)+(255&T)/255*p*255;o=this._calcCanvasStyle(x,b)}if(r.lineWidth=x.width,r.lineCap=x.cap,r.lineJoin=x.join,r.miterLimit=x.miterLimit,g.type===i.SHAPES.POLY){r.beginPath();var S=(A=f).points,m=g.holes,M=void 0,P=void 0,_=void 0,C=void 0;r.moveTo(S[0],S[1]);for(var I=2;I<S.length;I+=2)r.lineTo(S[I],S[I+1]);if(A.closeStroke&&r.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){r.moveTo(S[0],S[1]);for(I=2;I<S.length;I+=2)r.lineTo(S[I],S[I+1])}else{r.moveTo(S[S.length-2],S[S.length-1]);for(I=S.length-4;I>=0;I-=2)r.lineTo(S[I],S[I+1])}m[w].shape.closeStroke&&r.closePath()}}u.visible&&(r.globalAlpha=u.alpha*a,r.fillStyle=s,r.fill()),x.visible&&(r.globalAlpha=x.alpha*a,r.strokeStyle=o,r.stroke())}else if(g.type===i.SHAPES.RECT){var A=f;u.visible&&(r.globalAlpha=u.alpha*a,r.fillStyle=s,r.fillRect(A.x,A.y,A.width,A.height)),x.visible&&(r.globalAlpha=x.alpha*a,r.strokeStyle=o,r.strokeRect(A.x,A.y,A.width,A.height))}else if(g.type===i.SHAPES.CIRC){A=f;r.beginPath(),r.arc(A.x,A.y,A.radius,0,2*Math.PI),r.closePath(),u.visible&&(r.globalAlpha=u.alpha*a,r.fillStyle=s,r.fill()),x.visible&&(r.globalAlpha=x.alpha*a,r.strokeStyle=o,r.stroke())}else if(g.type===i.SHAPES.ELIP){var k=2*(A=f).width,E=2*A.height,R=A.x-k/2,G=A.y-E/2;r.beginPath();var X=k/2*.5522848,H=E/2*.5522848,L=R+k,q=G+E,z=R+k/2,D=G+E/2;r.moveTo(R,D),r.bezierCurveTo(R,D-H,z-X,G,z,G),r.bezierCurveTo(z+X,G,L,D-H,L,D),r.bezierCurveTo(L,D+H,z+X,q,z,q),r.bezierCurveTo(z-X,q,R,D+H,R,D),r.closePath(),u.visible&&(r.globalAlpha=u.alpha*a,r.fillStyle=s,r.fill()),x.visible&&(r.globalAlpha=x.alpha*a,r.strokeStyle=o,r.stroke())}else if(g.type===i.SHAPES.RREC){var j=(A=f).x,B=A.y,N=A.width,O=A.height,V=A.radius,W=Math.min(N,O)/2|0;V=V>W?W:V,r.beginPath(),r.moveTo(j,B+V),r.lineTo(j,B+O-V),r.quadraticCurveTo(j,B+O,j+V,B+O),r.lineTo(j+N-V,B+O),r.quadraticCurveTo(j+N,B+O,j+N,B+O-V),r.lineTo(j+N,B+V),r.quadraticCurveTo(j+N,B,j+N-V,B),r.lineTo(j+V,B),r.quadraticCurveTo(j,B,j,B+V),r.closePath(),u.visible&&(r.globalAlpha=u.alpha*a,r.fillStyle=s,r.fill()),x.visible&&(r.globalAlpha=x.alpha*a,r.strokeStyle=o,r.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,this._svgMatrix=null,this._tempMatrix=null},e}(),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({width:a.width,height:a.height,scaleMode:e,resolution: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.setResolution(i),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.3.3
* Compiled Tue, 04 Aug 2020 16:23:09 UTC
* @pixi/canvas-graphics - v5.3.4
* Compiled Mon, 14 Dec 2020 19:48:09 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 @@ /**

var res;
if (style.texture) {
if (style.texture && style.texture.baseTexture !== Texture.WHITE.baseTexture) {
if (style.texture.valid) {

@@ -54,0 +54,0 @@ res = canvasUtils.getTintedPattern(style.texture, tint);

/*!
* @pixi/canvas-graphics - v5.3.3
* Compiled Tue, 04 Aug 2020 16:23:09 UTC
* @pixi/canvas-graphics - v5.3.4
* Compiled Mon, 14 Dec 2020 19:48:09 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 @@ /**

var res;
if (style.texture) {
if (style.texture && style.texture.baseTexture !== core.Texture.WHITE.baseTexture) {
if (style.texture.valid) {

@@ -58,0 +58,0 @@ res = canvasRenderer$1.canvasUtils.getTintedPattern(style.texture, tint);

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

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

"dependencies": {
"@pixi/canvas-renderer": "5.3.3",
"@pixi/constants": "5.3.3",
"@pixi/core": "5.3.3",
"@pixi/graphics": "5.3.3",
"@pixi/math": "5.3.3"
"@pixi/canvas-renderer": "5.3.4",
"@pixi/constants": "5.3.4",
"@pixi/core": "5.3.4",
"@pixi/graphics": "5.3.4",
"@pixi/math": "5.3.4"
},
"gitHead": "6b3e881673511c885e3ef834e558c68771bb8b77"
"gitHead": "f6a5f18e9d5a9b6e57d7bdcb0c369f88cd83530c"
}

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