Socket
Socket
Sign inDemoInstall

bwip-js

Package Overview
Dependencies
0
Maintainers
1
Versions
98
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.3 to 3.0.4

1

bin/symdesc.js

@@ -105,2 +105,3 @@ // file: bwip-js/bin/symdesc.js

"sscc18": "SSCC-18",
"swissqrcode": "Swiss QR Code",
"symbol": "Miscellaneous symbols",

@@ -107,0 +108,0 @@ "telepen": "Telepen",

@@ -82,2 +82,3 @@ // file: bwip-js/lib/symdesc.js

"qrcode":{ sym:"qrcode",desc:"QR Code",text:"http://goo.gl/0bis",opts:"eclevel=M" },
"swissqrcode":{ sym:"swissqrcode",desc:"Swiss QR Code",text:"",opts:"" },
"microqrcode":{ sym:"microqrcode",desc:"Micro QR Code",text:"1234",opts:"" },

@@ -84,0 +85,0 @@ "rectangularmicroqrcode":{ sym:"rectangularmicroqrcode",desc:"Rectangular Micro QR Code",text:"1234",opts:"version=R17x139" },

2

package.json
{
"name": "bwip-js",
"version": "3.0.3",
"version": "3.0.4",
"description": "JavaScript barcode generator supporting over 100 types and standards.",

@@ -5,0 +5,0 @@ "main": "./dist/bwip-js-node.js",

@@ -20,3 +20,3 @@ # // Barcode Writer in Pure JavaScript

* Current bwip-js version is 3.0.3 (2021-07-29)
* Current bwip-js version is 3.0.4 (2021-08-05)
* Current BWIPP version is 2021-02-06

@@ -599,2 +599,3 @@ * Node.js compatibility: 0.12+

* sscc18 • SSCC-18
* swissqrcode • Swiss QR Code
* symbol • Miscellaneous symbols

@@ -601,0 +602,0 @@ * telepen • Telepen

@@ -44,2 +44,3 @@ // file : bwipjs.js

this.g_rgb = [0,0,0]; // current color (black)
this.g_clip = false; // clip region active
};

@@ -77,3 +78,9 @@ BWIPJS.prototype.save = function() {

}
var ctx = this.gstk.pop();
var ctx = this.gstk.pop();
var self = this;
if (this.g_clip && !ctx.g_clip) {
this.cmds.push(function() {
self.drawing.unclip();
});
}
for (var id in ctx) {

@@ -157,2 +164,6 @@ this[id] = ctx[id];

};
// Used only by swissqrcode
BWIPJS.prototype.setrgbcolor = function(r,g,b) {
this.g_rgb = [ r, g, b ];
};
// Returns the current rgb values as a 'RRGGBB'

@@ -492,3 +503,24 @@ BWIPJS.prototype.getRGB = function() {

};
BWIPJS.prototype.clip = function() {
var path = this.g_path;
this.g_path = [];
this.g_clip = true;
var self = this;
this.cmds.push(function() {
var polys = [];
for (var i = 0; i < path.length; i++) {
var a = path[i];
if (a.op == 'p') {
var pts = a.poly
self.transform(pts);
polys.push(pts);
} else {
throw new Error('clip: only polygon regions supported');
}
}
self.drawing.clip(polys);
});
};
// The pix array is in standard (not y-inverted postscript) orientation.

@@ -495,0 +527,0 @@ BWIPJS.prototype.maxicode = function(pix) {

@@ -24,2 +24,3 @@ // drawing-builtin.js

var gs_xymap; // even-odd edge map
var gs_xyclip; // clip region map (similar to xymap)

@@ -29,3 +30,9 @@ return {

scale : function(sx, sy) {
return [ (sx|0)||1, (sy|0)||1 ];
// swissqrcode requires clipping and drawing that are not scaled to the
// the barcode module size.
if (opts.bcid == 'swissqrcode') {
return [ sx, sy ];
} else {
return [ (sx|0)||1, (sy|0)||1 ];
}
},

@@ -101,2 +108,3 @@

gs_xymap.min = Infinity;
gs_xyclip = null;
gs_r = gs_g = gs_b = 0;

@@ -148,4 +156,4 @@

// Polygons are used to draw the connected regions in a 2d barcode.
// These will always be unstroked, filled, non-intersecting,
// orthogonal shapes.
// These will always be unstroked, filled, orthogonal shapes.
//
// You will see a series of polygon() calls, followed by a fill().

@@ -221,6 +229,6 @@ polygon : function(pts) {

var y = pts[0][1]|0;
var qh = pts[1][1] - pts[0][1]; // height of triangle (quarter height)
var vh = pts[2][1] - pts[1][1] - 1; // height of vertical side
var xl = pts[2][0]; // left side
var xr = pts[4][0]; // right side
var qh = (pts[1][1] - pts[0][1])|0; // height of triangle (quarter height)
var vh = (pts[2][1] - pts[1][1] - 1)|0; // height of vertical side
var xl = (pts[2][0])|0; // left side
var xr = (pts[4][0])|0; // right side

@@ -248,3 +256,3 @@ gs_r = parseInt(rgb.substr(0,2), 16);

ellipse : function(x, y, rx, ry, ccw) {
drawEllipse(x-rx, y-ry, x+rx, y+ry, ccw);
drawEllipse((x-rx)|0, (y-ry)|0, (x+rx)|0, (y+ry)|0, ccw);
},

@@ -261,2 +269,26 @@ // PostScript's default fill rule is even-odd.

},
// Currently only used by swissqrcode. The `polys` area is an array of
// arrays of points. Each array of points is identical to the `pts`
// parameter passed to polygon(). The clipping rule, like the fill rule,
// uses even-odd logic.
clip : function(polys) {
if (!gs_xyclip) {
gs_xyclip = [];
gs_xyclip.min = Infinity;
}
// Swap out the xymap for the clip map so addPoint() works on it.
var xymap = gs_xymap;
gs_xymap = gs_xyclip;
// Now just use the polygon() logic to fill in the clipping regions.
for (var i = 0, l = polys.length; i < l; i++) {
this.polygon(polys[i]);
}
// Restore
gs_xymap = xymap;
},
unclip : function() {
gs_xyclip = null;
},
// Draw text with optional inter-character spacing. `y` is the baseline.

@@ -309,2 +341,5 @@ // font is an object with properties { name, width, height, dx }

function set(x, y, a) {
if (gs_xyclip && clipped(x, y)) {
return;
}
// translate/rotate

@@ -442,2 +477,26 @@ x += gs_dx;

// Returns true if outside the clipping region.
function clipped(x, y) {
var pts = gs_xyclip[y];
if (!pts) {
return true;
}
if (!pts.sorted) {
pts.sort(function(a, b) { return a - b; });
pts.sorted = true;
}
var wn = false;
for (var n = 0, npts = pts.length; n < npts; n++) {
var xn = pts[n];
if (xn > x) {
return !wn;
} else if (xn == x) {
return wn;
}
wn = !wn;
}
return true;
}
// Returns 1 if clockwise, -1 if ccw.

@@ -444,0 +503,0 @@ function polydir(pts) {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc