This commit is contained in:
Yamozha
2021-04-02 02:24:13 +03:00
parent c23950b545
commit 7256d79e2c
31493 changed files with 3036630 additions and 0 deletions

53
node_modules/@jimp/plugin-displace/dist/index.js generated vendored Normal file
View File

@ -0,0 +1,53 @@
"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;
module.exports = exports.default;
//# sourceMappingURL=index.js.map

1
node_modules/@jimp/plugin-displace/dist/index.js.map generated vendored Normal file
View 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,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I,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"}