初始化fy
This commit is contained in:
11
uni_modules/UniDevTools/node_modules/@jimp/plugin-gaussian/CHANGELOG.md
generated
vendored
Normal file
11
uni_modules/UniDevTools/node_modules/@jimp/plugin-gaussian/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
# 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-gaussian/LICENSE
generated
vendored
Normal file
21
uni_modules/UniDevTools/node_modules/@jimp/plugin-gaussian/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.
|
||||
25
uni_modules/UniDevTools/node_modules/@jimp/plugin-gaussian/README.md
generated
vendored
Normal file
25
uni_modules/UniDevTools/node_modules/@jimp/plugin-gaussian/README.md
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<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-gaussian</h1>
|
||||
<p>Gaussian blur an image.</p>
|
||||
</div>
|
||||
|
||||
Applies a true Gaussian blur to the image (warning: this is VERY slow)
|
||||
|
||||
## Usage
|
||||
|
||||
- @param {number} r the pixel radius of the blur
|
||||
- @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.gaussian(15);
|
||||
}
|
||||
|
||||
main();
|
||||
```
|
||||
87
uni_modules/UniDevTools/node_modules/@jimp/plugin-gaussian/dist/index.js
generated
vendored
Normal file
87
uni_modules/UniDevTools/node_modules/@jimp/plugin-gaussian/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _utils = require("@jimp/utils");
|
||||
|
||||
/**
|
||||
* Applies a true Gaussian blur to the image (warning: this is VERY slow)
|
||||
* @param {number} r the pixel radius of the blur
|
||||
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
|
||||
* @returns {Jimp} this for chaining of methods
|
||||
*/
|
||||
var _default = function _default() {
|
||||
return {
|
||||
gaussian: function gaussian(r, cb) {
|
||||
// http://blog.ivank.net/fastest-gaussian-blur.html
|
||||
if (typeof r !== 'number') {
|
||||
return _utils.throwError.call(this, 'r must be a number', cb);
|
||||
}
|
||||
|
||||
if (r < 1) {
|
||||
return _utils.throwError.call(this, 'r must be greater than 0', cb);
|
||||
}
|
||||
|
||||
var rs = Math.ceil(r * 2.57); // significant radius
|
||||
|
||||
var range = rs * 2 + 1;
|
||||
var rr2 = r * r * 2;
|
||||
var rr2pi = rr2 * Math.PI;
|
||||
var weights = [];
|
||||
|
||||
for (var y = 0; y < range; y++) {
|
||||
weights[y] = [];
|
||||
|
||||
for (var x = 0; x < range; x++) {
|
||||
var dsq = Math.pow(x - rs, 2) + Math.pow(y - rs, 2);
|
||||
weights[y][x] = Math.exp(-dsq / rr2) / rr2pi;
|
||||
}
|
||||
}
|
||||
|
||||
for (var _y = 0; _y < this.bitmap.height; _y++) {
|
||||
for (var _x = 0; _x < this.bitmap.width; _x++) {
|
||||
var red = 0;
|
||||
var green = 0;
|
||||
var blue = 0;
|
||||
var alpha = 0;
|
||||
var wsum = 0;
|
||||
|
||||
for (var iy = 0; iy < range; iy++) {
|
||||
for (var ix = 0; ix < range; ix++) {
|
||||
var x1 = Math.min(this.bitmap.width - 1, Math.max(0, ix + _x - rs));
|
||||
var y1 = Math.min(this.bitmap.height - 1, Math.max(0, iy + _y - rs));
|
||||
var weight = weights[iy][ix];
|
||||
|
||||
var _idx = y1 * this.bitmap.width + x1 << 2;
|
||||
|
||||
red += this.bitmap.data[_idx] * weight;
|
||||
green += this.bitmap.data[_idx + 1] * weight;
|
||||
blue += this.bitmap.data[_idx + 2] * weight;
|
||||
alpha += this.bitmap.data[_idx + 3] * weight;
|
||||
wsum += weight;
|
||||
}
|
||||
|
||||
var idx = _y * this.bitmap.width + _x << 2;
|
||||
this.bitmap.data[idx] = Math.round(red / wsum);
|
||||
this.bitmap.data[idx + 1] = Math.round(green / wsum);
|
||||
this.bitmap.data[idx + 2] = Math.round(blue / wsum);
|
||||
this.bitmap.data[idx + 3] = Math.round(alpha / wsum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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-gaussian/dist/index.js.map
generated
vendored
Normal file
1
uni_modules/UniDevTools/node_modules/@jimp/plugin-gaussian/dist/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
86
uni_modules/UniDevTools/node_modules/@jimp/plugin-gaussian/es/index.js
generated
vendored
Normal file
86
uni_modules/UniDevTools/node_modules/@jimp/plugin-gaussian/es/index.js
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _utils = require("@jimp/utils");
|
||||
|
||||
/**
|
||||
* Applies a true Gaussian blur to the image (warning: this is VERY slow)
|
||||
* @param {number} r the pixel radius of the blur
|
||||
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
|
||||
* @returns {Jimp} this for chaining of methods
|
||||
*/
|
||||
var _default = function _default() {
|
||||
return {
|
||||
gaussian: function gaussian(r, cb) {
|
||||
// http://blog.ivank.net/fastest-gaussian-blur.html
|
||||
if (typeof r !== 'number') {
|
||||
return _utils.throwError.call(this, 'r must be a number', cb);
|
||||
}
|
||||
|
||||
if (r < 1) {
|
||||
return _utils.throwError.call(this, 'r must be greater than 0', cb);
|
||||
}
|
||||
|
||||
var rs = Math.ceil(r * 2.57); // significant radius
|
||||
|
||||
var range = rs * 2 + 1;
|
||||
var rr2 = r * r * 2;
|
||||
var rr2pi = rr2 * Math.PI;
|
||||
var weights = [];
|
||||
|
||||
for (var y = 0; y < range; y++) {
|
||||
weights[y] = [];
|
||||
|
||||
for (var x = 0; x < range; x++) {
|
||||
var dsq = Math.pow(x - rs, 2) + Math.pow(y - rs, 2);
|
||||
weights[y][x] = Math.exp(-dsq / rr2) / rr2pi;
|
||||
}
|
||||
}
|
||||
|
||||
for (var _y = 0; _y < this.bitmap.height; _y++) {
|
||||
for (var _x = 0; _x < this.bitmap.width; _x++) {
|
||||
var red = 0;
|
||||
var green = 0;
|
||||
var blue = 0;
|
||||
var alpha = 0;
|
||||
var wsum = 0;
|
||||
|
||||
for (var iy = 0; iy < range; iy++) {
|
||||
for (var ix = 0; ix < range; ix++) {
|
||||
var x1 = Math.min(this.bitmap.width - 1, Math.max(0, ix + _x - rs));
|
||||
var y1 = Math.min(this.bitmap.height - 1, Math.max(0, iy + _y - rs));
|
||||
var weight = weights[iy][ix];
|
||||
|
||||
var _idx = y1 * this.bitmap.width + x1 << 2;
|
||||
|
||||
red += this.bitmap.data[_idx] * weight;
|
||||
green += this.bitmap.data[_idx + 1] * weight;
|
||||
blue += this.bitmap.data[_idx + 2] * weight;
|
||||
alpha += this.bitmap.data[_idx + 3] * weight;
|
||||
wsum += weight;
|
||||
}
|
||||
|
||||
var idx = _y * this.bitmap.width + _x << 2;
|
||||
this.bitmap.data[idx] = Math.round(red / wsum);
|
||||
this.bitmap.data[idx + 1] = Math.round(green / wsum);
|
||||
this.bitmap.data[idx + 2] = Math.round(blue / wsum);
|
||||
this.bitmap.data[idx + 3] = Math.round(alpha / wsum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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-gaussian/es/index.js.map
generated
vendored
Normal file
1
uni_modules/UniDevTools/node_modules/@jimp/plugin-gaussian/es/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
7
uni_modules/UniDevTools/node_modules/@jimp/plugin-gaussian/index.d.ts
generated
vendored
Normal file
7
uni_modules/UniDevTools/node_modules/@jimp/plugin-gaussian/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import { ImageCallback } from '@jimp/core';
|
||||
|
||||
interface Gaussian {
|
||||
gaussian(r: number, cb?: ImageCallback<this>): this;
|
||||
}
|
||||
|
||||
export default function(): Gaussian;
|
||||
31
uni_modules/UniDevTools/node_modules/@jimp/plugin-gaussian/package.json
generated
vendored
Normal file
31
uni_modules/UniDevTools/node_modules/@jimp/plugin-gaussian/package.json
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "@jimp/plugin-gaussian",
|
||||
"version": "0.10.3",
|
||||
"description": "gaussian blur an image.",
|
||||
"main": "dist/index.js",
|
||||
"module": "es/index.js",
|
||||
"types": "index.d.ts",
|
||||
"scripts": {
|
||||
"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"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "37197106eae5c26231018dfdc0254422f6b43927"
|
||||
}
|
||||
73
uni_modules/UniDevTools/node_modules/@jimp/plugin-gaussian/src/index.js
generated
vendored
Normal file
73
uni_modules/UniDevTools/node_modules/@jimp/plugin-gaussian/src/index.js
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
import { isNodePattern, throwError } from '@jimp/utils';
|
||||
|
||||
/**
|
||||
* Applies a true Gaussian blur to the image (warning: this is VERY slow)
|
||||
* @param {number} r the pixel radius of the blur
|
||||
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
|
||||
* @returns {Jimp} this for chaining of methods
|
||||
*/
|
||||
export default () => ({
|
||||
gaussian(r, cb) {
|
||||
// http://blog.ivank.net/fastest-gaussian-blur.html
|
||||
if (typeof r !== 'number') {
|
||||
return throwError.call(this, 'r must be a number', cb);
|
||||
}
|
||||
|
||||
if (r < 1) {
|
||||
return throwError.call(this, 'r must be greater than 0', cb);
|
||||
}
|
||||
|
||||
const rs = Math.ceil(r * 2.57); // significant radius
|
||||
const range = rs * 2 + 1;
|
||||
const rr2 = r * r * 2;
|
||||
const rr2pi = rr2 * Math.PI;
|
||||
|
||||
const weights = [];
|
||||
|
||||
for (let y = 0; y < range; y++) {
|
||||
weights[y] = [];
|
||||
for (let x = 0; x < range; x++) {
|
||||
const dsq = (x - rs) ** 2 + (y - rs) ** 2 ;
|
||||
weights[y][x] = Math.exp(-dsq / rr2) / rr2pi;
|
||||
}
|
||||
}
|
||||
|
||||
for (let y = 0; y < this.bitmap.height; y++) {
|
||||
for (let x = 0; x < this.bitmap.width; x++) {
|
||||
let red = 0;
|
||||
let green = 0;
|
||||
let blue = 0;
|
||||
let alpha = 0;
|
||||
let wsum = 0;
|
||||
|
||||
for (let iy = 0; iy < range; iy++) {
|
||||
for (let ix = 0; ix < range; ix++) {
|
||||
const x1 = Math.min(this.bitmap.width - 1, Math.max(0, ix + x - rs ));
|
||||
const y1 = Math.min(this.bitmap.height - 1, Math.max(0, iy + y - rs));
|
||||
const weight = weights[iy][ix];
|
||||
const idx = (y1 * this.bitmap.width + x1) << 2;
|
||||
|
||||
red += this.bitmap.data[idx] * weight;
|
||||
green += this.bitmap.data[idx + 1] * weight;
|
||||
blue += this.bitmap.data[idx + 2] * weight;
|
||||
alpha += this.bitmap.data[idx + 3] * weight;
|
||||
wsum += weight;
|
||||
}
|
||||
|
||||
const idx = (y * this.bitmap.width + x) << 2;
|
||||
|
||||
this.bitmap.data[idx] = Math.round(red / wsum);
|
||||
this.bitmap.data[idx + 1] = Math.round(green / wsum);
|
||||
this.bitmap.data[idx + 2] = Math.round(blue / wsum);
|
||||
this.bitmap.data[idx + 3] = Math.round(alpha / wsum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isNodePattern(cb)) {
|
||||
cb.call(this, null, this);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user