Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/invoice_pdf/node_modules/@jimp/plugin-shadow/es/ drwxr-xr-x | |
| Viewing file: Select action/file-type: import { isNodePattern } from "@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
*/
export default (() => ({
shadow() {
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
let cb = arguments.length > 1 ? arguments[1] : undefined;
if (typeof options === "function") {
cb = options;
options = {};
}
const {
opacity = 0.7,
size = 1.1,
x = -25,
y = 25,
blur = 5
} = options;
// clone the image
const orig = this.clone();
const shadow = this.clone();
// turn all it's pixels black
shadow.scan(0, 0, shadow.bitmap.width, shadow.bitmap.height, (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 (isNodePattern(cb)) {
cb.call(this, null, this);
}
return this;
}
}));
//# sourceMappingURL=index.js.map |
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0296 ]-- |