初始化
This commit is contained in:
24
uni_modules/UniDevTools/node_modules/@jimp/plugin-shadow/CHANGELOG.md
generated
vendored
Normal file
24
uni_modules/UniDevTools/node_modules/@jimp/plugin-shadow/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
# v0.9.4 (Tue Mar 03 2020)
|
||||
|
||||
#### 🐛 Bug Fix
|
||||
|
||||
- `@jimp/plugin-shadow`
|
||||
- Update plugin-shadow type definition. [#841](https://github.com/oliver-moran/jimp/pull/841) ([@lekoaf](https://github.com/lekoaf))
|
||||
|
||||
#### Authors: 1
|
||||
|
||||
- Martin ([@lekoaf](https://github.com/lekoaf))
|
||||
|
||||
---
|
||||
|
||||
# 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
uni_modules/UniDevTools/node_modules/@jimp/plugin-shadow/LICENSE
generated
vendored
Normal file
21
uni_modules/UniDevTools/node_modules/@jimp/plugin-shadow/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.
|
||||
30
uni_modules/UniDevTools/node_modules/@jimp/plugin-shadow/README.md
generated
vendored
Normal file
30
uni_modules/UniDevTools/node_modules/@jimp/plugin-shadow/README.md
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
<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-shadow</h1>
|
||||
<p>Creates a shadow on an image.</p>
|
||||
</div>
|
||||
|
||||
## Usage
|
||||
|
||||
- @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
|
||||
|
||||
```js
|
||||
import jimp from 'jimp';
|
||||
|
||||
async function main() {
|
||||
const image = await jimp.read('test/image.png');
|
||||
|
||||
image.shadow();
|
||||
// or
|
||||
image.shadow({ opacity: 0.8, size: 1.2, blur: 10, x: -75, y: -75 });
|
||||
}
|
||||
|
||||
main();
|
||||
```
|
||||
38
uni_modules/UniDevTools/node_modules/@jimp/plugin-shadow/babel.config.js
generated
vendored
Normal file
38
uni_modules/UniDevTools/node_modules/@jimp/plugin-shadow/babel.config.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
module.exports = api => {
|
||||
api.cache(true);
|
||||
|
||||
return {
|
||||
presets: [
|
||||
[
|
||||
'@babel/env',
|
||||
{
|
||||
useBuiltIns: 'usage'
|
||||
}
|
||||
]
|
||||
],
|
||||
|
||||
plugins: [
|
||||
'@babel/proposal-class-properties',
|
||||
'@babel/syntax-object-rest-spread',
|
||||
process.env.BABEL_ENV !== 'module' && 'add-module-exports',
|
||||
[
|
||||
'transform-inline-environment-variables',
|
||||
{ include: ['BABEL_ENV', 'ENV'] }
|
||||
]
|
||||
].filter(Boolean),
|
||||
|
||||
env: {
|
||||
test: {
|
||||
plugins: ['istanbul']
|
||||
},
|
||||
development: {
|
||||
plugins: [process.env.ENV !== 'browser' && 'source-map-support'].filter(
|
||||
Boolean
|
||||
)
|
||||
},
|
||||
module: {
|
||||
presets: [['@babel/env', { modules: false }]]
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
77
uni_modules/UniDevTools/node_modules/@jimp/plugin-shadow/dist/index.js
generated
vendored
Normal file
77
uni_modules/UniDevTools/node_modules/@jimp/plugin-shadow/dist/index.js
generated
vendored
Normal 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
uni_modules/UniDevTools/node_modules/@jimp/plugin-shadow/dist/index.js.map
generated
vendored
Normal file
1
uni_modules/UniDevTools/node_modules/@jimp/plugin-shadow/dist/index.js.map
generated
vendored
Normal 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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M,CACHkB,MADH,CACUlB,MAAM,CAACW,MAAP,CAAcC,KAAd,GAAsBR,IADhC,EACsCJ,MAAM,CAACW,MAAP,CAAcE,MAAd,GAAuBT,IAD7D,EAEGG,IAFH,CAEQA,IAFR,EAnCuB,CAuCvB;;AACA,WAAKY,SAAL,CAAenB,MAAf,EAAuBK,CAAvB,EAA0BC,CAA1B;AACA,WAAKa,SAAL,CAAeX,IAAf,EAAqB,CAArB,EAAwB,CAAxB;;AAEA,UAAI,0BAAcN,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACkB,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAjDmB,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"}
|
||||
76
uni_modules/UniDevTools/node_modules/@jimp/plugin-shadow/es/index.js
generated
vendored
Normal file
76
uni_modules/UniDevTools/node_modules/@jimp/plugin-shadow/es/index.js
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
"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;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
uni_modules/UniDevTools/node_modules/@jimp/plugin-shadow/es/index.js.map
generated
vendored
Normal file
1
uni_modules/UniDevTools/node_modules/@jimp/plugin-shadow/es/index.js.map
generated
vendored
Normal 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,OAA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;AACA,QAAA,KAAI,CAACH,MAAL,CAAYI,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B,IAA5B;AACA,QAAA,KAAI,CAACH,MAAL,CAAYI,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B,IAA5B;AACA,QAAA,KAAI,CAACH,MAAL,CAAYI,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B,IAA5B;AACD,OAlBH,EAbuB,CAkCvB;;AACAd,MAAAA,MAAM,CACHkB,MADH,CACUlB,MAAM,CAACW,MAAP,CAAcC,KAAd,GAAsBR,IADhC,EACsCJ,MAAM,CAACW,MAAP,CAAcE,MAAd,GAAuBT,IAD7D,EAEGG,IAFH,CAEQA,IAFR,EAnCuB,CAuCvB;;AACA,WAAKY,SAAL,CAAenB,MAAf,EAAuBK,CAAvB,EAA0BC,CAA1B;AACA,WAAKa,SAAL,CAAeX,IAAf,EAAqB,CAArB,EAAwB,CAAxB;;AAEA,UAAI,0BAAcN,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACkB,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAjDmB,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"}
|
||||
15
uni_modules/UniDevTools/node_modules/@jimp/plugin-shadow/index.d.ts
generated
vendored
Normal file
15
uni_modules/UniDevTools/node_modules/@jimp/plugin-shadow/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import { ImageCallback } from '@jimp/core';
|
||||
|
||||
interface Shadow {
|
||||
shadow(options?: {
|
||||
size?: number,
|
||||
opacity?: number,
|
||||
blur: number,
|
||||
x?: number,
|
||||
y?: number
|
||||
},
|
||||
cb?: ImageCallback<this>): this;
|
||||
shadow(cb?: ImageCallback<this>): this;
|
||||
}
|
||||
|
||||
export default function(): Shadow;
|
||||
42
uni_modules/UniDevTools/node_modules/@jimp/plugin-shadow/package.json
generated
vendored
Normal file
42
uni_modules/UniDevTools/node_modules/@jimp/plugin-shadow/package.json
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "@jimp/plugin-shadow",
|
||||
"version": "0.10.3",
|
||||
"description": "Creates a shadow on an image.",
|
||||
"main": "dist/index.js",
|
||||
"module": "es/index.js",
|
||||
"types": "index.d.ts",
|
||||
"scripts": {
|
||||
"test": "cross-env BABEL_ENV=test mocha --require @babel/register",
|
||||
"test:watch": "npm run test -- --reporter min --watch",
|
||||
"test:coverage": "nyc npm run test",
|
||||
"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",
|
||||
"@jimp/plugin-blur": ">=0.3.5",
|
||||
"@jimp/plugin-resize": ">=0.3.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@jimp/custom": "^0.10.3",
|
||||
"@jimp/plugin-blur": "^0.10.3",
|
||||
"@jimp/plugin-resize": "^0.10.3",
|
||||
"@jimp/test-utils": "^0.10.3"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "37197106eae5c26231018dfdc0254422f6b43927"
|
||||
}
|
||||
64
uni_modules/UniDevTools/node_modules/@jimp/plugin-shadow/src/index.js
generated
vendored
Normal file
64
uni_modules/UniDevTools/node_modules/@jimp/plugin-shadow/src/index.js
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
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(options = {}, cb) {
|
||||
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;
|
||||
}
|
||||
});
|
||||
BIN
uni_modules/UniDevTools/node_modules/@jimp/plugin-shadow/test/images/shadow.png
generated
vendored
Normal file
BIN
uni_modules/UniDevTools/node_modules/@jimp/plugin-shadow/test/images/shadow.png
generated
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 216 B |
31
uni_modules/UniDevTools/node_modules/@jimp/plugin-shadow/test/shadow.test.js
generated
vendored
Normal file
31
uni_modules/UniDevTools/node_modules/@jimp/plugin-shadow/test/shadow.test.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
import { Jimp, mkJGD, getTestDir } from '@jimp/test-utils';
|
||||
import configure from '@jimp/custom';
|
||||
import resize from '@jimp/plugin-resize';
|
||||
import blur from '@jimp/plugin-blur';
|
||||
|
||||
import shadow from '../src';
|
||||
|
||||
const jimp = configure({ plugins: [shadow, resize, blur] }, Jimp);
|
||||
|
||||
describe('Shadow', () => {
|
||||
it('creates a shadow', async () => {
|
||||
const expectedImg = await jimp.read(
|
||||
getTestDir(__dirname) + '/images/shadow.png'
|
||||
);
|
||||
const testImage = await jimp.read(
|
||||
mkJGD(
|
||||
' ',
|
||||
' ◆◆ ',
|
||||
' ◆▦▦◆ ',
|
||||
' ◆▦▦▦▦◆ ',
|
||||
' ◆▦▦◆ ',
|
||||
' ◆◆ ',
|
||||
' '
|
||||
)
|
||||
);
|
||||
|
||||
testImage
|
||||
.shadow({ x: -1, y: 1, blur: 1 })
|
||||
.bitmap.data.should.be.deepEqual(expectedImg.bitmap.data);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user