@jimp/utils
Advanced tools
Comparing version
@@ -11,3 +11,10 @@ "use strict"; | ||
exports.scan = scan; | ||
exports.scanIterator = scanIterator; | ||
require("regenerator-runtime/runtime"); | ||
var _marked = | ||
/*#__PURE__*/ | ||
regeneratorRuntime.mark(scanIterator); | ||
function isNodePattern(cb) { | ||
@@ -53,2 +60,57 @@ if (typeof cb === 'undefined') { | ||
} | ||
function scanIterator(image, x, y, w, h) { | ||
var _y, _x, idx; | ||
return regeneratorRuntime.wrap(function scanIterator$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
// round input | ||
x = Math.round(x); | ||
y = Math.round(y); | ||
w = Math.round(w); | ||
h = Math.round(h); | ||
_y = y; | ||
case 5: | ||
if (!(_y < y + h)) { | ||
_context.next = 17; | ||
break; | ||
} | ||
_x = x; | ||
case 7: | ||
if (!(_x < x + w)) { | ||
_context.next = 14; | ||
break; | ||
} | ||
idx = image.bitmap.width * _y + _x << 2; | ||
_context.next = 11; | ||
return { | ||
x: _x, | ||
y: _y, | ||
idx: idx, | ||
image: image | ||
}; | ||
case 11: | ||
_x++; | ||
_context.next = 7; | ||
break; | ||
case 14: | ||
_y++; | ||
_context.next = 5; | ||
break; | ||
case 17: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
} | ||
}, _marked); | ||
} | ||
//# sourceMappingURL=index.js.map |
@@ -0,1 +1,5 @@ | ||
var _marked = | ||
/*#__PURE__*/ | ||
regeneratorRuntime.mark(scanIterator); | ||
export function isNodePattern(cb) { | ||
@@ -39,2 +43,56 @@ if (typeof cb === 'undefined') { | ||
} | ||
export function scanIterator(image, x, y, w, h) { | ||
var _y, _x, idx; | ||
return regeneratorRuntime.wrap(function scanIterator$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
// round input | ||
x = Math.round(x); | ||
y = Math.round(y); | ||
w = Math.round(w); | ||
h = Math.round(h); | ||
_y = y; | ||
case 5: | ||
if (!(_y < y + h)) { | ||
_context.next = 17; | ||
break; | ||
} | ||
_x = x; | ||
case 7: | ||
if (!(_x < x + w)) { | ||
_context.next = 14; | ||
break; | ||
} | ||
idx = image.bitmap.width * _y + _x << 2; | ||
_context.next = 11; | ||
return { | ||
x: _x, | ||
y: _y, | ||
idx: idx, | ||
image: image | ||
}; | ||
case 11: | ||
_x++; | ||
_context.next = 7; | ||
break; | ||
case 14: | ||
_y++; | ||
_context.next = 5; | ||
break; | ||
case 17: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
} | ||
}, _marked); | ||
} | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@jimp/utils", | ||
"version": "0.8.5-canary.b147e81.0", | ||
"version": "0.8.5", | ||
"description": "Utils for jimp extensions.", | ||
@@ -25,3 +25,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "b147e810972b2bba9bea4a132c3026ca119832e7" | ||
"gitHead": "60b635dd77b6ea900043d81d09a12ff82fd14fd0" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
16096
43.01%223
81.3%