@jimp/plugin-shadow
Advanced tools
Comparing version 0.20.2 to 0.21.0--canary.1149.3239903.0
@@ -6,6 +6,4 @@ "use strict"; | ||
}); | ||
exports["default"] = void 0; | ||
exports.default = void 0; | ||
var _utils = require("@jimp/utils"); | ||
/** | ||
@@ -22,58 +20,49 @@ * Creates a circle out of an image. | ||
*/ | ||
var _default = function _default() { | ||
return { | ||
shadow: function shadow() { | ||
var _this = this; | ||
var _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; | ||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var cb = arguments.length > 1 ? arguments[1] : undefined; | ||
// clone the image | ||
const orig = this.clone(); | ||
const shadow = this.clone(); | ||
if (typeof options === "function") { | ||
cb = options; | ||
options = {}; | ||
} | ||
// 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; | ||
}); | ||
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 | ||
// enlarge it. This creates a "shadow". | ||
shadow.resize(shadow.bitmap.width * size, shadow.bitmap.height * size).blur(blur); | ||
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; | ||
// 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); | ||
} | ||
}; | ||
}; | ||
exports["default"] = _default; | ||
return this; | ||
} | ||
}); | ||
exports.default = _default; | ||
module.exports = exports.default; | ||
//# sourceMappingURL=index.js.map |
@@ -1,10 +0,3 @@ | ||
"use strict"; | ||
import { isNodePattern } from "@jimp/utils"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports["default"] = void 0; | ||
var _utils = require("@jimp/utils"); | ||
/** | ||
@@ -21,57 +14,47 @@ * Creates a circle out of an image. | ||
*/ | ||
var _default = function _default() { | ||
return { | ||
shadow: function shadow() { | ||
var _this = this; | ||
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; | ||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var cb = arguments.length > 1 ? arguments[1] : undefined; | ||
// clone the image | ||
const orig = this.clone(); | ||
const shadow = this.clone(); | ||
if (typeof options === "function") { | ||
cb = options; | ||
options = {}; | ||
} | ||
// 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; | ||
}); | ||
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 | ||
// enlarge it. This creates a "shadow". | ||
shadow.resize(shadow.bitmap.width * size, shadow.bitmap.height * size).blur(blur); | ||
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; | ||
// 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); | ||
} | ||
}; | ||
}; | ||
exports["default"] = _default; | ||
return this; | ||
} | ||
})); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@jimp/plugin-shadow", | ||
"version": "0.20.2", | ||
"version": "0.21.0--canary.1149.3239903.0", | ||
"description": "Creates a shadow on an image.", | ||
@@ -24,4 +24,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@babel/runtime": "^7.7.2", | ||
"@jimp/utils": "^0.20.2" | ||
"@jimp/utils": "0.21.0--canary.1149.3239903.0" | ||
}, | ||
@@ -34,6 +33,6 @@ "peerDependencies": { | ||
"devDependencies": { | ||
"@jimp/custom": "^0.20.2", | ||
"@jimp/plugin-blur": "^0.20.2", | ||
"@jimp/plugin-resize": "^0.20.2", | ||
"@jimp/test-utils": "^0.20.2" | ||
"@jimp/custom": "0.21.0--canary.1149.3239903.0", | ||
"@jimp/plugin-blur": "0.21.0--canary.1149.3239903.0", | ||
"@jimp/plugin-resize": "0.21.0--canary.1149.3239903.0", | ||
"@jimp/test-utils": "0.21.0--canary.1149.3239903.0" | ||
}, | ||
@@ -43,3 +42,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "cebbdb72f889102a8e3c42b25ad3243b16e3a485" | ||
"gitHead": "323990352ce279d67297aed097b37bd8ec66ef51" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4
20684
245
+ Added@jimp/utils@0.21.0--canary.1149.3239903.0(transitive)
- Removed@babel/runtime@^7.7.2
- Removed@babel/runtime@7.26.0(transitive)
- Removed@jimp/utils@0.20.2(transitive)
- Removedregenerator-runtime@0.14.1(transitive)