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

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

@ -0,0 +1,77 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _utils = require("@jimp/utils");
/**
* Creates a circle out of an image.
* @param {function(Error, Jimp)} options (optional)
* opacity - opacity of the shadow between 0 and 1
* size,- of the shadow
* blur - how blurry the shadow is
* x- x position of shadow
* y - y position of shadow
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
* @returns {Jimp} this for chaining of methods
*/
var _default = function _default() {
return {
shadow: function shadow() {
var _this = this;
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var cb = arguments.length > 1 ? arguments[1] : undefined;
if (typeof options === 'function') {
cb = options;
options = {};
}
var _options = options,
_options$opacity = _options.opacity,
opacity = _options$opacity === void 0 ? 0.7 : _options$opacity,
_options$size = _options.size,
size = _options$size === void 0 ? 1.1 : _options$size,
_options$x = _options.x,
x = _options$x === void 0 ? -25 : _options$x,
_options$y = _options.y,
y = _options$y === void 0 ? 25 : _options$y,
_options$blur = _options.blur,
blur = _options$blur === void 0 ? 5 : _options$blur; // clone the image
var orig = this.clone();
var shadow = this.clone(); // turn all it's pixels black
shadow.scan(0, 0, shadow.bitmap.width, shadow.bitmap.height, function (x, y, idx) {
shadow.bitmap.data[idx] = 0x00;
shadow.bitmap.data[idx + 1] = 0x00;
shadow.bitmap.data[idx + 2] = 0x00; // up the opacity a little,
shadow.bitmap.data[idx + 3] = shadow.constructor.limit255(shadow.bitmap.data[idx + 3] * opacity);
_this.bitmap.data[idx] = 0x00;
_this.bitmap.data[idx + 1] = 0x00;
_this.bitmap.data[idx + 2] = 0x00;
_this.bitmap.data[idx + 3] = 0x00;
}); // enlarge it. This creates a "shadow".
shadow.resize(shadow.bitmap.width * size, shadow.bitmap.height * size).blur(blur); // Then blit the "shadow" onto the background and the image on top of that.
this.composite(shadow, x, y);
this.composite(orig, 0, 0);
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-shadow/dist/index.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../src/index.js"],"names":["shadow","options","cb","opacity","size","x","y","blur","orig","clone","scan","bitmap","width","height","idx","data","constructor","limit255","resize","composite","call"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;;;;;eAWe;AAAA,SAAO;AACpBA,IAAAA,MADoB,oBACK;AAAA;;AAAA,UAAlBC,OAAkB,uEAAR,EAAQ;AAAA,UAAJC,EAAI;;AACvB,UAAI,OAAOD,OAAP,KAAmB,UAAvB,EAAmC;AACjCC,QAAAA,EAAE,GAAGD,OAAL;AACAA,QAAAA,OAAO,GAAG,EAAV;AACD;;AAJsB,qBAM0CA,OAN1C;AAAA,sCAMfE,OANe;AAAA,UAMfA,OANe,iCAML,GANK;AAAA,mCAMAC,IANA;AAAA,UAMAA,IANA,8BAMO,GANP;AAAA,gCAMYC,CANZ;AAAA,UAMYA,CANZ,2BAMgB,CAAC,EANjB;AAAA,gCAMqBC,CANrB;AAAA,UAMqBA,CANrB,2BAMyB,EANzB;AAAA,mCAM6BC,IAN7B;AAAA,UAM6BA,IAN7B,8BAMoC,CANpC,kBAQvB;;AACA,UAAMC,IAAI,GAAG,KAAKC,KAAL,EAAb;AACA,UAAMT,MAAM,GAAG,KAAKS,KAAL,EAAf,CAVuB,CAYvB;;AACAT,MAAAA,MAAM,CAACU,IAAP,CACE,CADF,EAEE,CAFF,EAGEV,MAAM,CAACW,MAAP,CAAcC,KAHhB,EAIEZ,MAAM,CAACW,MAAP,CAAcE,MAJhB,EAKE,UAACR,CAAD,EAAIC,CAAJ,EAAOQ,GAAP,EAAe;AACbd,QAAAA,MAAM,CAACW,MAAP,CAAcI,IAAd,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AjDmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern } from '@jimp/utils';\n\n/**\n * Creates a circle out of an image.\n * @param {function(Error, Jimp)} options (optional)\n * opacity - opacity of the shadow between 0 and 1\n * size,- of the shadow\n * blur - how blurry the shadow is\n * x- x position of shadow\n * y - y position of shadow\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n shadow(options = {}, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n const { opacity = 0.7, size = 1.1, x = -25, y = 25, blur = 5 } = options;\n\n // clone the image\n const orig = this.clone();\n const shadow = this.clone();\n\n // turn all it's pixels black\n shadow.scan(\n 0,\n 0,\n shadow.bitmap.width,\n shadow.bitmap.height,\n (x, y, idx) => {\n shadow.bitmap.data[idx] = 0x00;\n shadow.bitmap.data[idx + 1] = 0x00;\n shadow.bitmap.data[idx + 2] = 0x00;\n // up the opacity a little,\n shadow.bitmap.data[idx + 3] = shadow.constructor.limit255(\n shadow.bitmap.data[idx + 3] * opacity\n );\n\n this.bitmap.data[idx] = 0x00;\n this.bitmap.data[idx + 1] = 0x00;\n this.bitmap.data[idx + 2] = 0x00;\n this.bitmap.data[idx + 3] = 0x00;\n }\n );\n\n // enlarge it. This creates a \"shadow\".\n shadow\n .resize(shadow.bitmap.width * size, shadow.bitmap.height * size)\n .blur(blur);\n\n // Then blit the \"shadow\" onto the background and the image on top of that.\n this.composite(shadow, x, y);\n this.composite(orig, 0, 0);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"}