yeet
This commit is contained in:
34
node_modules/@jimp/utils/CHANGELOG.md
generated
vendored
Normal file
34
node_modules/@jimp/utils/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
# v0.11.0 (Fri May 15 2020)
|
||||
|
||||
#### 🚀 Enhancement
|
||||
|
||||
- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil))
|
||||
|
||||
#### Authors: 1
|
||||
|
||||
- Eric Rabil ([@EricRabil](https://github.com/EricRabil))
|
||||
|
||||
---
|
||||
|
||||
# v0.10.1 (Sun Apr 05 2020)
|
||||
|
||||
#### 🐛 Bug Fix
|
||||
|
||||
- Update package.json [#870](https://github.com/oliver-moran/jimp/pull/870) ([@arcanis](https://github.com/arcanis))
|
||||
|
||||
#### Authors: 1
|
||||
|
||||
- Maël Nison ([@arcanis](https://github.com/arcanis))
|
||||
|
||||
---
|
||||
|
||||
# v0.9.3 (Tue Nov 26 2019)
|
||||
|
||||
#### 🐛 Bug Fix
|
||||
|
||||
- Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie))
|
||||
|
||||
#### Authors: 2
|
||||
|
||||
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
|
||||
- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
|
21
node_modules/@jimp/utils/LICENSE
generated
vendored
Normal file
21
node_modules/@jimp/utils/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 Oliver Moran
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
67
node_modules/@jimp/utils/README.md
generated
vendored
Normal file
67
node_modules/@jimp/utils/README.md
generated
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
<div align="center">
|
||||
<img width="200" height="200"
|
||||
src="https://s3.amazonaws.com/pix.iemoji.com/images/emoji/apple/ios-11/256/crayon.png">
|
||||
<h1>@jimp/utils</h1>
|
||||
<p>Utils for jimp extensions.</p>
|
||||
</div>
|
||||
|
||||
## Available Methods
|
||||
|
||||
### isNodePattern
|
||||
|
||||
Determines if function was passed an node callback.
|
||||
|
||||
```js
|
||||
if (isNodePattern(cb)) {
|
||||
cb.call(this, null, this);
|
||||
}
|
||||
```
|
||||
|
||||
### throwError
|
||||
|
||||
Either throws the error or calls the callback with the error.
|
||||
|
||||
```js
|
||||
if (/* check for error */) {
|
||||
return throwError.call(this, 'someError', cb);
|
||||
}
|
||||
```
|
||||
|
||||
### scan
|
||||
|
||||
Scans through a region of the bitmap, calling a function for each pixel.
|
||||
|
||||
```js
|
||||
function removeRed(image) {
|
||||
return scan(image, 0, 0, image.bitmap.width, image.bitmap.height, function(
|
||||
x,
|
||||
y,
|
||||
index
|
||||
) {
|
||||
const red = this.bitmap.data[index + 0];
|
||||
const green = this.bitmap.data[index + 1];
|
||||
const blue = this.bitmap.data[index + 2];
|
||||
const alpha = this.bitmap.data[index + 3];
|
||||
|
||||
this.bitmap.data[index + 0] = 0;
|
||||
this.bitmap.data[index + 1] = green;
|
||||
this.bitmap.data[index + 2] = blue;
|
||||
this.bitmap.data[index + 3] = alpha;
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
### scanIterator
|
||||
|
||||
It's possible to make an iterator scan with a `for ... of`, if you want to `break` the scan before it reaches the end, but note, that this iterator has a huge performance implication:
|
||||
|
||||
```js
|
||||
for (const { x, y, idx, image } of scanIterator(
|
||||
image,
|
||||
0,
|
||||
0,
|
||||
image.bitmap.width,
|
||||
image.bitmap.height
|
||||
)) {
|
||||
}
|
||||
```
|
114
node_modules/@jimp/utils/dist/index.js
generated
vendored
Normal file
114
node_modules/@jimp/utils/dist/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/dist/index.js.map
generated
vendored
Normal file
1
node_modules/@jimp/utils/dist/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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AAA","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"}
|
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,KAAV,CAAR;AACD;;AAED,MAAI,OAAOH,EAAP,KAAc,UAAlB,EAA8B;AAC5B,WAAOA,EAAE,CAACK,IAAH,CAAQ,IAAR,EAAcF,KAAd,CAAP;AACD;;AAED,QAAMA,KAAN;AACD;;AAEM,SAASG,IAAT,CAAcC,KAAd,EAAqBC,CAArB,EAAwBC,CAAxB,EAA2BC,CAA3B,EAA8BC,CAA9B,EAAiCC,CAAjC,EAAoC;AACzC;AACAJ,EAAAA,CAAC,GAAGK,IAAI,CAACC,KAAL,CAAWN,CAAX,CAAJ;AACAC,EAAAA,CAAC,GAAGI,IAAI,CAACC,KAAL,CAAWL,CAAX,CAAJ;AACAC,EAAAA,CAAC,GAAGG,IAAI,CAACC,KAAL,CAAWJ,CAAX,CAAJ;AACAC,EAAAA,CAAC,GAAGE,IAAI,CAACC,KAAL,CAAWH,CAAX,CAAJ;;AAEA,OAAK,IAAII,EAAE,GAAGN,CAAd,EA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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"}
|
9
node_modules/@jimp/utils/index.d.ts
generated
vendored
Normal file
9
node_modules/@jimp/utils/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
import { Image, Omit } from '@jimp/core';
|
||||
import { ThrowStatement } from 'typescript';
|
||||
|
||||
export function isNodePattern(cb: Function): true;
|
||||
export function isNodePattern(cb: Omit<any, Function>): false;
|
||||
|
||||
export function throwError(error: string | Error, cb?: (err: Error) => void): ThrowStatement;
|
||||
|
||||
export function scan(image: Image, x: number, y: number, w: number, h: number, f: (image: Image, _x: number, _y: number, idx: number) => void): Image;
|
27
node_modules/@jimp/utils/package.json
generated
vendored
Normal file
27
node_modules/@jimp/utils/package.json
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
"name": "@jimp/utils",
|
||||
"version": "0.12.1",
|
||||
"description": "Utils for jimp extensions.",
|
||||
"main": "dist/index.js",
|
||||
"module": "es/index.js",
|
||||
"types": "index.d.ts",
|
||||
"scripts": {
|
||||
"build": "npm run build:node:production && npm run build:module",
|
||||
"build:watch": "npm run build:node:debug -- -- --watch --verbose",
|
||||
"build:debug": "npm run build:node:debug",
|
||||
"build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js",
|
||||
"build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js",
|
||||
"build:node:debug": "cross-env BABEL_ENV=development npm run build:node",
|
||||
"build:node:production": "cross-env BABEL_ENV=production npm run build:node"
|
||||
},
|
||||
"author": "",
|
||||
"license": "MIT",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.7.2",
|
||||
"regenerator-runtime": "^0.13.3"
|
||||
},
|
||||
"gitHead": "942e635564e36fc243767531b4f8be036afa40b5"
|
||||
}
|
55
node_modules/@jimp/utils/src/index.js
generated
vendored
Normal file
55
node_modules/@jimp/utils/src/index.js
generated
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
export function isNodePattern(cb) {
|
||||
if (typeof cb === 'undefined') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (typeof cb !== 'function') {
|
||||
throw new TypeError('Callback must be a function');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
export function throwError(error, cb) {
|
||||
if (typeof error === 'string') {
|
||||
error = new Error(error);
|
||||
}
|
||||
|
||||
if (typeof cb === 'function') {
|
||||
return cb.call(this, error);
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
|
||||
export 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 (let _y = y; _y < y + h; _y++) {
|
||||
for (let _x = x; _x < x + w; _x++) {
|
||||
const idx = (image.bitmap.width * _y + _x) << 2;
|
||||
f.call(image, _x, _y, idx);
|
||||
}
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
export function* scanIterator(image, x, y, w, h) {
|
||||
// round input
|
||||
x = Math.round(x);
|
||||
y = Math.round(y);
|
||||
w = Math.round(w);
|
||||
h = Math.round(h);
|
||||
|
||||
for (let _y = y; _y < y + h; _y++) {
|
||||
for (let _x = x; _x < x + w; _x++) {
|
||||
const idx = (image.bitmap.width * _y + _x) << 2;
|
||||
yield { x: _x, y: _y, idx, image };
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user