This commit is contained in:
11
node_modules/@jimp/plugin-displace/CHANGELOG.md
generated
vendored
Normal file
11
node_modules/@jimp/plugin-displace/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
# v0.9.3 (Tue Nov 26 2019)
|
||||
|
||||
#### 🐛 Bug Fix
|
||||
|
||||
- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils`
|
||||
- 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/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();
|
||||
```
|
||||
52
node_modules/@jimp/plugin-displace/es/index.js
generated
vendored
Normal file
52
node_modules/@jimp/plugin-displace/es/index.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
||||
|
||||
var _utils = require("@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
|
||||
*/
|
||||
var _default = function _default() {
|
||||
return {
|
||||
displace: function displace(map, offset, cb) {
|
||||
if ((0, _typeof2["default"])(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;
|
||||
//# 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":["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,yBAAOF,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"}
|
||||
7
node_modules/@jimp/plugin-displace/index.d.ts
generated
vendored
Normal file
7
node_modules/@jimp/plugin-displace/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import { Jimp, ImageCallback } from '@jimp/core';
|
||||
|
||||
interface Displace {
|
||||
displace(map: Jimp, offset: number, cb?: ImageCallback<this>): this;
|
||||
}
|
||||
|
||||
export default function(): Displace;
|
||||
31
node_modules/@jimp/plugin-displace/package.json
generated
vendored
Normal file
31
node_modules/@jimp/plugin-displace/package.json
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "@jimp/plugin-displace",
|
||||
"version": "0.10.3",
|
||||
"description": "displace an image.",
|
||||
"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",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.7.2",
|
||||
"@jimp/utils": "^0.10.3",
|
||||
"core-js": "^3.4.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@jimp/custom": ">=0.3.5"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "37197106eae5c26231018dfdc0254422f6b43927"
|
||||
}
|
||||
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