WIP - add extractor, generate snippet_data
This commit is contained in:
21
node_modules/@jimp/plugin-displace/LICENSE
generated
vendored
Normal file
21
node_modules/@jimp/plugin-displace/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.
|
||||
27
node_modules/@jimp/plugin-displace/README.md
generated
vendored
Normal file
27
node_modules/@jimp/plugin-displace/README.md
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
<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/plugin-displace</h1>
|
||||
<p>Displace an image.</p>
|
||||
</div>
|
||||
|
||||
Displaces the image based on the provided displacement map
|
||||
|
||||
## Usage
|
||||
|
||||
- @param {object} map the source Jimp instance
|
||||
- @param {number} offset the maximum displacement value
|
||||
- @param {function(Error, Jimp)} cb (optional) a callback for when complete
|
||||
|
||||
```js
|
||||
import jimp from 'jimp';
|
||||
|
||||
async function main() {
|
||||
const image = await jimp.read('test/image.png');
|
||||
|
||||
// Make me better!
|
||||
image.displace(map, 10);
|
||||
}
|
||||
|
||||
main();
|
||||
```
|
||||
57
node_modules/@jimp/plugin-displace/dist/index.js
generated
vendored
Normal file
57
node_modules/@jimp/plugin-displace/dist/index.js
generated
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
"use strict";
|
||||
|
||||
require("core-js/modules/es6.object.define-property");
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
require("core-js/modules/es7.symbol.async-iterator");
|
||||
|
||||
require("core-js/modules/es6.symbol");
|
||||
|
||||
var _utils = require("@jimp/utils");
|
||||
|
||||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
/**
|
||||
* Displaces the image based on the provided displacement map
|
||||
* @param {object} map the source Jimp instance
|
||||
* @param {number} offset the maximum displacement value
|
||||
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
|
||||
* @returns {Jimp} this for chaining of methods
|
||||
*/
|
||||
var _default = function _default() {
|
||||
return {
|
||||
displace: function displace(map, offset, cb) {
|
||||
if (_typeof(map) !== 'object' || map.constructor !== this.constructor) {
|
||||
return _utils.throwError.call(this, 'The source must be a Jimp image', cb);
|
||||
}
|
||||
|
||||
if (typeof offset !== 'number') {
|
||||
return _utils.throwError.call(this, 'factor must be a number', cb);
|
||||
}
|
||||
|
||||
var source = this.cloneQuiet();
|
||||
this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
|
||||
var displacement = map.bitmap.data[idx] / 256 * offset;
|
||||
displacement = Math.round(displacement);
|
||||
var ids = this.getPixelIndex(x + displacement, y);
|
||||
this.bitmap.data[ids] = source.bitmap.data[idx];
|
||||
this.bitmap.data[ids + 1] = source.bitmap.data[idx + 1];
|
||||
this.bitmap.data[ids + 2] = source.bitmap.data[idx + 2];
|
||||
});
|
||||
|
||||
if ((0, _utils.isNodePattern)(cb)) {
|
||||
cb.call(this, null, this);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
exports.default = _default;
|
||||
module.exports = exports.default;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@jimp/plugin-displace/dist/index.js.map
generated
vendored
Normal file
1
node_modules/@jimp/plugin-displace/dist/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/index.js"],"names":["displace","map","offset","cb","constructor","throwError","call","source","cloneQuiet","scanQuiet","bitmap","width","height","x","y","idx","displacement","data","Math","round","ids","getPixelIndex"],"mappings":";;;;;;;;;;;;;AAAA;;;;AAEA;;;;;;;eAOe;AAAA,SAAO;AACpBA,IAAAA,QADoB,oBACXC,GADW,EACNC,MADM,EACEC,EADF,EACM;AACxB,UAAI,QAAOF,GAAP,MAAe,QAAf,IAA2BA,GAAG,CAACG,WAAJ,KAAoB,KAAKA,WAAxD,EAAqE;AACnE,eAAOC,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,iCAAtB,EAAyDH,EAAzD,CAAP;AACD;;AAED,UAAI,OAAOD,MAAP,KAAkB,QAAtB,EAAgC;AAC9B,eAAOG,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDH,EAAjD,CAAP;AACD;;AAED,UAAMI,MAAM,GAAG,KAAKC,UAAL,EAAf;AACA,WAAKC,SAAL,CAAe,CAAf,EAAkB,CAAlB,EAAqB,KAAKC,MAAL,CAAYC,KAAjC,EAAwC,KAAKD,MAAL,CAAYE,MAApD,EAA4D,UAC1DC,CAD0D,EAE1DC,CAF0D,EAG1DC,GAH0D,EAI1D;AACA,YAAIC,YAAY,GAAIf,GAAG,CAACS,MAAJ,CAAWO,IAAX,CAAgBF,GAAhB,IAAuB,GAAxB,GAA+Bb,MAAlD;AACAc,QAAAA,YAAY,GAAGE,IAAI,CAACC,KAAL,CAAWH,YAAX,CAAf;AAEA,YAAMI,GAAG,GAAG,KAAKC,aAAL,CAAmBR,CAAC,GAAGG,YAAvB,EAAqCF,CAArC,CAAZ;AACA,aAAKJ,MAAL,CAAYO,IAAZ,CAAiBG,GAAjB,IAAwBb,MAAM,CAACG,MAAP,CAAcO,IAAd,CAAmBF,GAAnB,CAAxB;AACA,aAAKL,MAAL,CAAYO,IAAZ,CAAiBG,GAAG,GAAG,CAAvB,IAA4Bb,MAAM,CAACG,MAAP,CAAcO,IAAd,CAAmBF,GAAG,GAAG,CAAzB,CAA5B;AACA,aAAKL,MAAL,CAAYO,IAAZ,CAAiBG,GAAG,GAAG,CAAvB,IAA4Bb,MAAM,CAACG,MAAP,CAAcO,IAAd,CAAmBF,GAAG,GAAG,CAAzB,CAA5B;AACD,OAZD;;AAcA,UAAI,0BAAcZ,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACG,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AA9BmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Displaces the image based on the provided displacement map\n * @param {object} map the source Jimp instance\n * @param {number} offset the maximum displacement value\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n displace(map, offset, cb) {\n if (typeof map !== 'object' || map.constructor !== this.constructor) {\n return throwError.call(this, 'The source must be a Jimp image', cb);\n }\n\n if (typeof offset !== 'number') {\n return throwError.call(this, 'factor must be a number', cb);\n }\n\n const source = this.cloneQuiet();\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n let displacement = (map.bitmap.data[idx] / 256) * offset;\n displacement = Math.round(displacement);\n\n const ids = this.getPixelIndex(x + displacement, y);\n this.bitmap.data[ids] = source.bitmap.data[idx];\n this.bitmap.data[ids + 1] = source.bitmap.data[idx + 1];\n this.bitmap.data[ids + 2] = source.bitmap.data[idx + 2];\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"}
|
||||
41
node_modules/@jimp/plugin-displace/es/index.js
generated
vendored
Normal file
41
node_modules/@jimp/plugin-displace/es/index.js
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
import { isNodePattern, throwError } from '@jimp/utils';
|
||||
/**
|
||||
* Displaces the image based on the provided displacement map
|
||||
* @param {object} map the source Jimp instance
|
||||
* @param {number} offset the maximum displacement value
|
||||
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
|
||||
* @returns {Jimp} this for chaining of methods
|
||||
*/
|
||||
|
||||
export default (function () {
|
||||
return {
|
||||
displace: function displace(map, offset, cb) {
|
||||
if (_typeof(map) !== 'object' || map.constructor !== this.constructor) {
|
||||
return throwError.call(this, 'The source must be a Jimp image', cb);
|
||||
}
|
||||
|
||||
if (typeof offset !== 'number') {
|
||||
return throwError.call(this, 'factor must be a number', cb);
|
||||
}
|
||||
|
||||
var source = this.cloneQuiet();
|
||||
this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
|
||||
var displacement = map.bitmap.data[idx] / 256 * offset;
|
||||
displacement = Math.round(displacement);
|
||||
var ids = this.getPixelIndex(x + displacement, y);
|
||||
this.bitmap.data[ids] = source.bitmap.data[idx];
|
||||
this.bitmap.data[ids + 1] = source.bitmap.data[idx + 1];
|
||||
this.bitmap.data[ids + 2] = source.bitmap.data[idx + 2];
|
||||
});
|
||||
|
||||
if (isNodePattern(cb)) {
|
||||
cb.call(this, null, this);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
};
|
||||
});
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@jimp/plugin-displace/es/index.js.map
generated
vendored
Normal file
1
node_modules/@jimp/plugin-displace/es/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/index.js"],"names":["isNodePattern","throwError","displace","map","offset","cb","constructor","call","source","cloneQuiet","scanQuiet","bitmap","width","height","x","y","idx","displacement","data","Math","round","ids","getPixelIndex"],"mappings":";;AAAA,SAASA,aAAT,EAAwBC,UAAxB,QAA0C,aAA1C;AAEA;;;;;;;;AAOA,gBAAe;AAAA,SAAO;AACpBC,IAAAA,QADoB,oBACXC,GADW,EACNC,MADM,EACEC,EADF,EACM;AACxB,UAAI,QAAOF,GAAP,MAAe,QAAf,IAA2BA,GAAG,CAACG,WAAJ,KAAoB,KAAKA,WAAxD,EAAqE;AACnE,eAAOL,UAAU,CAACM,IAAX,CAAgB,IAAhB,EAAsB,iCAAtB,EAAyDF,EAAzD,CAAP;AACD;;AAED,UAAI,OAAOD,MAAP,KAAkB,QAAtB,EAAgC;AAC9B,eAAOH,UAAU,CAACM,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDF,EAAjD,CAAP;AACD;;AAED,UAAMG,MAAM,GAAG,KAAKC,UAAL,EAAf;AACA,WAAKC,SAAL,CAAe,CAAf,EAAkB,CAAlB,EAAqB,KAAKC,MAAL,CAAYC,KAAjC,EAAwC,KAAKD,MAAL,CAAYE,MAApD,EAA4D,UAC1DC,CAD0D,EAE1DC,CAF0D,EAG1DC,GAH0D,EAI1D;AACA,YAAIC,YAAY,GAAId,GAAG,CAACQ,MAAJ,CAAWO,IAAX,CAAgBF,GAAhB,IAAuB,GAAxB,GAA+BZ,MAAlD;AACAa,QAAAA,YAAY,GAAGE,IAAI,CAACC,KAAL,CAAWH,YAAX,CAAf;AAEA,YAAMI,GAAG,GAAG,KAAKC,aAAL,CAAmBR,CAAC,GAAGG,YAAvB,EAAqCF,CAArC,CAAZ;AACA,aAAKJ,MAAL,CAAYO,IAAZ,CAAiBG,GAAjB,IAAwBb,MAAM,CAACG,MAAP,CAAcO,IAAd,CAAmBF,GAAnB,CAAxB;AACA,aAAKL,MAAL,CAAYO,IAAZ,CAAiBG,GAAG,GAAG,CAAvB,IAA4Bb,MAAM,CAACG,MAAP,CAAcO,IAAd,CAAmBF,GAAG,GAAG,CAAzB,CAA5B;AACA,aAAKL,MAAL,CAAYO,IAAZ,CAAiBG,GAAG,GAAG,CAAvB,IAA4Bb,MAAM,CAACG,MAAP,CAAcO,IAAd,CAAmBF,GAAG,GAAG,CAAzB,CAA5B;AACD,OAZD;;AAcA,UAAIhB,aAAa,CAACK,EAAD,CAAjB,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AA9BmB,GAAP;AAAA,CAAf","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Displaces the image based on the provided displacement map\n * @param {object} map the source Jimp instance\n * @param {number} offset the maximum displacement value\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n displace(map, offset, cb) {\n if (typeof map !== 'object' || map.constructor !== this.constructor) {\n return throwError.call(this, 'The source must be a Jimp image', cb);\n }\n\n if (typeof offset !== 'number') {\n return throwError.call(this, 'factor must be a number', cb);\n }\n\n const source = this.cloneQuiet();\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n let displacement = (map.bitmap.data[idx] / 256) * offset;\n displacement = Math.round(displacement);\n\n const ids = this.getPixelIndex(x + displacement, y);\n this.bitmap.data[ids] = source.bitmap.data[idx];\n this.bitmap.data[ids + 1] = source.bitmap.data[idx + 1];\n this.bitmap.data[ids + 2] = source.bitmap.data[idx + 2];\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"}
|
||||
55
node_modules/@jimp/plugin-displace/package.json
generated
vendored
Normal file
55
node_modules/@jimp/plugin-displace/package.json
generated
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
{
|
||||
"_from": "@jimp/plugin-displace@^0.6.4",
|
||||
"_id": "@jimp/plugin-displace@0.6.4",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-MEvtBXOAio/3iGJkKBrTtFs3Q38ez2Wy/wTD0Ruas+L8fjJR7l4mDgV+zjRr57CqB5mpY+L48VEoa2/gNXh9cg==",
|
||||
"_location": "/@jimp/plugin-displace",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@jimp/plugin-displace@^0.6.4",
|
||||
"name": "@jimp/plugin-displace",
|
||||
"escapedName": "@jimp%2fplugin-displace",
|
||||
"scope": "@jimp",
|
||||
"rawSpec": "^0.6.4",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^0.6.4"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@jimp/plugins"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@jimp/plugin-displace/-/plugin-displace-0.6.4.tgz",
|
||||
"_shasum": "7d641e402aade5d13d8eea93dc94fac39027da97",
|
||||
"_spec": "@jimp/plugin-displace@^0.6.4",
|
||||
"_where": "/Users/stefanfejes/Projects/30-seconds-of-python-code/node_modules/@jimp/plugins",
|
||||
"author": "",
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@jimp/utils": "^0.6.4",
|
||||
"core-js": "^2.5.7"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "displace an image.",
|
||||
"gitHead": "7c9d3c817cade88d4a20422be10670d3c1528429",
|
||||
"license": "MIT",
|
||||
"main": "dist/index.js",
|
||||
"module": "es/index.js",
|
||||
"name": "@jimp/plugin-displace",
|
||||
"peerDependencies": {
|
||||
"@jimp/custom": ">=0.3.5"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "npm run build:node:production && npm run build:module",
|
||||
"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",
|
||||
"build:watch": "npm run build:node:debug -- -- --watch --verbose"
|
||||
},
|
||||
"version": "0.6.4"
|
||||
}
|
||||
41
node_modules/@jimp/plugin-displace/src/index.js
generated
vendored
Normal file
41
node_modules/@jimp/plugin-displace/src/index.js
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
import { isNodePattern, throwError } from '@jimp/utils';
|
||||
|
||||
/**
|
||||
* Displaces the image based on the provided displacement map
|
||||
* @param {object} map the source Jimp instance
|
||||
* @param {number} offset the maximum displacement value
|
||||
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
|
||||
* @returns {Jimp} this for chaining of methods
|
||||
*/
|
||||
export default () => ({
|
||||
displace(map, offset, cb) {
|
||||
if (typeof map !== 'object' || map.constructor !== this.constructor) {
|
||||
return throwError.call(this, 'The source must be a Jimp image', cb);
|
||||
}
|
||||
|
||||
if (typeof offset !== 'number') {
|
||||
return throwError.call(this, 'factor must be a number', cb);
|
||||
}
|
||||
|
||||
const source = this.cloneQuiet();
|
||||
this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(
|
||||
x,
|
||||
y,
|
||||
idx
|
||||
) {
|
||||
let displacement = (map.bitmap.data[idx] / 256) * offset;
|
||||
displacement = Math.round(displacement);
|
||||
|
||||
const ids = this.getPixelIndex(x + displacement, y);
|
||||
this.bitmap.data[ids] = source.bitmap.data[idx];
|
||||
this.bitmap.data[ids + 1] = source.bitmap.data[idx + 1];
|
||||
this.bitmap.data[ids + 2] = source.bitmap.data[idx + 2];
|
||||
});
|
||||
|
||||
if (isNodePattern(cb)) {
|
||||
cb.call(this, null, this);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user