yeet
This commit is contained in:
114
node_modules/@jimp/utils/es/index.js
generated
vendored
Normal file
114
node_modules/@jimp/utils/es/index.js
generated
vendored
Normal file
@ -0,0 +1,114 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.isNodePattern = isNodePattern;
|
||||
exports.throwError = throwError;
|
||||
exports.scan = scan;
|
||||
exports.scanIterator = scanIterator;
|
||||
|
||||
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
||||
|
||||
var _marked =
|
||||
/*#__PURE__*/
|
||||
_regenerator["default"].mark(scanIterator);
|
||||
|
||||
function isNodePattern(cb) {
|
||||
if (typeof cb === 'undefined') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (typeof cb !== 'function') {
|
||||
throw new TypeError('Callback must be a function');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function throwError(error, cb) {
|
||||
if (typeof error === 'string') {
|
||||
error = new Error(error);
|
||||
}
|
||||
|
||||
if (typeof cb === 'function') {
|
||||
return cb.call(this, error);
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
|
||||
function scan(image, x, y, w, h, f) {
|
||||
// round input
|
||||
x = Math.round(x);
|
||||
y = Math.round(y);
|
||||
w = Math.round(w);
|
||||
h = Math.round(h);
|
||||
|
||||
for (var _y = y; _y < y + h; _y++) {
|
||||
for (var _x = x; _x < x + w; _x++) {
|
||||
var idx = image.bitmap.width * _y + _x << 2;
|
||||
f.call(image, _x, _y, idx);
|
||||
}
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
function scanIterator(image, x, y, w, h) {
|
||||
var _y, _x, idx;
|
||||
|
||||
return _regenerator["default"].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
|
1
node_modules/@jimp/utils/es/index.js.map
generated
vendored
Normal file
1
node_modules/@jimp/utils/es/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/index.js"],"names":["scanIterator","isNodePattern","cb","TypeError","throwError","error","Error","call","scan","image","x","y","w","h","f","Math","round","_y","_x","idx","bitmap","width"],"mappings":";;;;;;;;;;;;;;;;6BAyCiBA,Y;;AAzCV,SAASC,aAAT,CAAuBC,EAAvB,EAA2B;AAChC,MAAI,OAAOA,EAAP,KAAc,WAAlB,EAA+B;AAC7B,WAAO,KAAP;AACD;;AAED,MAAI,OAAOA,EAAP,KAAc,UAAlB,EAA8B;AAC5B,UAAM,IAAIC,SAAJ,CAAc,6BAAd,CAAN;AACD;;AAED,SAAO,IAAP;AACD;;AAEM,SAASC,UAAT,CAAoBC,KAApB,EAA2BH,EAA3B,EAA+B;AACpC,MAAI,OAAOG,KAAP,KAAiB,QAArB,EAA+B;AAC7BA,IAAAA,KAAK,GAAG,IAAIC,KAAJ,CAAUD,K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AAWL,CAAX,CAAJ;AACAC,UAAAA,CAAC,GAAGG,IAAI,CAACC,KAAL,CAAWJ,CAAX,CAAJ;AACAC,UAAAA,CAAC,GAAGE,IAAI,CAACC,KAAL,CAAWH,CAAX,CAAJ;AAESI,UAAAA,EAPJ,GAOSN,CAPT;;AAAA;AAAA,gBAOYM,EAAE,GAAGN,CAAC,GAAGE,CAPrB;AAAA;AAAA;AAAA;;AAQMK,UAAAA,EARN,GAQWR,CARX;;AAAA;AAAA,gBAQcQ,EAAE,GAAGR,CAAC,GAAGE,CARvB;AAAA;AAAA;AAAA;;AASKO,UAAAA,GATL,GASYV,KAAK,CAACW,MAAN,CAAaC,KAAb,GAAqBJ,EAArB,GAA0BC,EAA3B,IAAkC,CAT7C;AAAA;AAUD,iBAAM;AAAER,YAAAA,CAAC,EAAEQ,EAAL;AAASP,YAAAA,CAAC,EAAEM,EAAZ;AAAgBE,YAAAA,GAAG,EAAHA,GAAhB;AAAqBV,YAAAA,KAAK,EAALA;AAArB,WAAN;;AAVC;AAQ0BS,UAAAA,EAAE,EAR5B;AAAA;AAAA;;AAAA;AAOwBD,UAAAA,EAAE,EAP1B;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export function isNodePattern(cb) {\n if (typeof cb === 'undefined') {\n return false;\n }\n\n if (typeof cb !== 'function') {\n throw new TypeError('Callback must be a function');\n }\n\n return true;\n}\n\nexport function throwError(error, cb) {\n if (typeof error === 'string') {\n error = new Error(error);\n }\n\n if (typeof cb === 'function') {\n return cb.call(this, error);\n }\n\n throw error;\n}\n\nexport function scan(image, x, y, w, h, f) {\n // round input\n x = Math.round(x);\n y = Math.round(y);\n w = Math.round(w);\n h = Math.round(h);\n\n for (let _y = y; _y < y + h; _y++) {\n for (let _x = x; _x < x + w; _x++) {\n const idx = (image.bitmap.width * _y + _x) << 2;\n f.call(image, _x, _y, idx);\n }\n }\n\n return image;\n}\n\nexport function* scanIterator(image, x, y, w, h) {\n // round input\n x = Math.round(x);\n y = Math.round(y);\n w = Math.round(w);\n h = Math.round(h);\n\n for (let _y = y; _y < y + h; _y++) {\n for (let _x = x; _x < x + w; _x++) {\n const idx = (image.bitmap.width * _y + _x) << 2;\n yield { x: _x, y: _y, idx, image };\n }\n }\n}\n"],"file":"index.js"}
|
Reference in New Issue
Block a user