初始化fy
This commit is contained in:
11
uni_modules/UniDevTools/node_modules/@jimp/plugin-circle/CHANGELOG.md
generated
vendored
Normal file
11
uni_modules/UniDevTools/node_modules/@jimp/plugin-circle/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-circle/LICENSE
generated
vendored
Normal file
21
uni_modules/UniDevTools/node_modules/@jimp/plugin-circle/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-circle/README.md
generated
vendored
Normal file
25
uni_modules/UniDevTools/node_modules/@jimp/plugin-circle/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-circle</h1>
|
||||
<p>Creates a circle out of an image.</p>
|
||||
</div>
|
||||
|
||||
## Usage
|
||||
|
||||
- @param {function(Error, Jimp)} options (optional) radius, x, y
|
||||
- @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.circle();
|
||||
// or
|
||||
image.circle({ radius: 50, x: 25, y: 25 });
|
||||
}
|
||||
|
||||
main();
|
||||
```
|
||||
53
uni_modules/UniDevTools/node_modules/@jimp/plugin-circle/dist/index.js
generated
vendored
Normal file
53
uni_modules/UniDevTools/node_modules/@jimp/plugin-circle/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
"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) radius, x, y
|
||||
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
|
||||
* @returns {Jimp} this for chaining of methods
|
||||
*/
|
||||
var _default = function _default() {
|
||||
return {
|
||||
circle: function circle() {
|
||||
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 radius = options.radius || (this.bitmap.width > this.bitmap.height ? this.bitmap.height : this.bitmap.width) / 2;
|
||||
var center = {
|
||||
x: typeof options.x === 'number' ? options.x : this.bitmap.width / 2,
|
||||
y: typeof options.y === 'number' ? options.y : this.bitmap.height / 2
|
||||
};
|
||||
this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
|
||||
var curR = Math.sqrt(Math.pow(x - center.x, 2) + Math.pow(y - center.y, 2));
|
||||
|
||||
if (radius - curR <= 0.0) {
|
||||
this.bitmap.data[idx + 3] = 0;
|
||||
} else if (radius - curR < 1.0) {
|
||||
this.bitmap.data[idx + 3] = 255 * (radius - curR);
|
||||
}
|
||||
});
|
||||
|
||||
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-circle/dist/index.js.map
generated
vendored
Normal file
1
uni_modules/UniDevTools/node_modules/@jimp/plugin-circle/dist/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/index.js"],"names":["circle","options","cb","radius","bitmap","width","height","center","x","y","scanQuiet","idx","curR","Math","sqrt","pow","data","call"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;eAMe;AAAA,SAAO;AACpBA,IAAAA,MADoB,oBACK;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;;AAED,UAAME,MAAM,GACVF,OAAO,CAACE,MAAR,IACA,CAAC,KAAKC,MAAL,CAAYC,KAAZ,GAAoB,KAAKD,MAAL,CAAYE,MAAhC,GACG,KAAKF,MAAL,CAAYE,MADf,GAEG,KAAKF,MAAL,CAAYC,KAFhB,IAEyB,CAJ3B;AAMA,UAAME,MAAM,GAAG;AACbC,QAAAA,CAAC,EAAE,OAAOP,OAAO,CAACO,CAAf,KAAqB,QAArB,GAAgCP,OAAO,CAACO,CAAxC,GAA4C,KAAKJ,MAAL,CAAYC,KAAZ,GAAoB,CADtD;AAEbI,QAAAA,CAAC,EAAE,OAAOR,OAAO,CAACQ,CAAf,KAAqB,QAArB,GAAgCR,OAAO,CAACQ,CAAxC,GAA4C,KAAKL,MAAL,CAAYE,MAAZ,GAAqB;AAFvD,OAAf;AAKA,WAAKI,SAAL,CAAe,CAAf,EAAkB,CAAlB,EAAqB,KAAKN,MAAL,CAAYC,KAAjC,EAAwC,KAAKD,MAAL,CAAYE,MAApD,EAA4D,UAC1DE,CAD0D,EAE1DC,CAF0D,EAG1DE,GAH0D,EAI1D;AACA,YAAMC,IAAI,GAAGC,IAAI,CAACC,IAAL,CACXD,IAAI,CAACE,GAAL,CAASP,CAAC,GAAGD,MAAM,CAACC,CAApB,EAAuB,CAAvB,IAA4BK,IAAI,CAACE,GAAL,CAASN,CAAC,GAAGF,MAAM,CAACE,CAApB,EAAuB,CAAvB,CADjB,CAAb;;AAIA,YAAIN,MAAM,GAAGS,IAAT,IAAiB,GAArB,EAA0B;AACxB,eAAKR,MAAL,CAAYY,IAAZ,CAAiBL,GAAG,GAAG,CAAvB,IAA4B,CAA5B;AACD,SAFD,MAEO,IAAIR,MAAM,GAAGS,IAAT,GAAgB,GAApB,EAAyB;AAC9B,eAAKR,MAAL,CAAYY,IAAZ,CAAiBL,GAAG,GAAG,CAAvB,IAA4B,OAAOR,MAAM,GAAGS,IAAhB,CAA5B;AACD;AACF,OAdD;;AAgBA,UAAI,0BAAcV,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACe,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAvCmB,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) radius, x, y\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n circle(options = {}, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n const radius =\n options.radius ||\n (this.bitmap.width > this.bitmap.height\n ? this.bitmap.height\n : this.bitmap.width) / 2;\n\n const center = {\n x: typeof options.x === 'number' ? options.x : this.bitmap.width / 2,\n y: typeof options.y === 'number' ? options.y : this.bitmap.height / 2\n };\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n const curR = Math.sqrt(\n Math.pow(x - center.x, 2) + Math.pow(y - center.y, 2)\n );\n\n if (radius - curR <= 0.0) {\n this.bitmap.data[idx + 3] = 0;\n } else if (radius - curR < 1.0) {\n this.bitmap.data[idx + 3] = 255 * (radius - curR);\n }\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"}
|
||||
52
uni_modules/UniDevTools/node_modules/@jimp/plugin-circle/es/index.js
generated
vendored
Normal file
52
uni_modules/UniDevTools/node_modules/@jimp/plugin-circle/es/index.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
"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) radius, x, y
|
||||
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
|
||||
* @returns {Jimp} this for chaining of methods
|
||||
*/
|
||||
var _default = function _default() {
|
||||
return {
|
||||
circle: function circle() {
|
||||
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 radius = options.radius || (this.bitmap.width > this.bitmap.height ? this.bitmap.height : this.bitmap.width) / 2;
|
||||
var center = {
|
||||
x: typeof options.x === 'number' ? options.x : this.bitmap.width / 2,
|
||||
y: typeof options.y === 'number' ? options.y : this.bitmap.height / 2
|
||||
};
|
||||
this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
|
||||
var curR = Math.sqrt(Math.pow(x - center.x, 2) + Math.pow(y - center.y, 2));
|
||||
|
||||
if (radius - curR <= 0.0) {
|
||||
this.bitmap.data[idx + 3] = 0;
|
||||
} else if (radius - curR < 1.0) {
|
||||
this.bitmap.data[idx + 3] = 255 * (radius - curR);
|
||||
}
|
||||
});
|
||||
|
||||
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-circle/es/index.js.map
generated
vendored
Normal file
1
uni_modules/UniDevTools/node_modules/@jimp/plugin-circle/es/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/index.js"],"names":["circle","options","cb","radius","bitmap","width","height","center","x","y","scanQuiet","idx","curR","Math","sqrt","pow","data","call"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;eAMe;AAAA,SAAO;AACpBA,IAAAA,MADoB,oBACK;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;;AAED,UAAME,MAAM,GACVF,OAAO,CAACE,MAAR,IACA,CAAC,KAAKC,MAAL,CAAYC,KAAZ,GAAoB,KAAKD,MAAL,CAAYE,MAAhC,GACG,KAAKF,MAAL,CAAYE,MADf,GAEG,KAAKF,MAAL,CAAYC,KAFhB,IAEyB,CAJ3B;AAMA,UAAME,MAAM,GAAG;AACbC,QAAAA,CAAC,EAAE,OAAOP,OAAO,CAACO,CAAf,KAAqB,QAArB,GAAgCP,OAAO,CAACO,CAAxC,GAA4C,KAAKJ,MAAL,CAAYC,KAAZ,GAAoB,CADtD;AAEbI,QAAAA,CAAC,EAAE,OAAOR,OAAO,CAACQ,CAAf,KAAqB,QAArB,GAAgCR,OAAO,CAACQ,CAAxC,GAA4C,KAAKL,MAAL,CAAYE,MAAZ,GAAqB;AAFvD,OAAf;AAKA,WAAKI,SAAL,CAAe,CAAf,EAAkB,CAAlB,EAAqB,KAAKN,MAAL,CAAYC,KAAjC,EAAwC,KAAKD,MAAL,CAAYE,MAApD,EAA4D,UAC1DE,CAD0D,EAE1DC,CAF0D,EAG1DE,GAH0D,EAI1D;AACA,YAAMC,IAAI,GAAGC,IAAI,CAACC,IAAL,CACXD,IAAI,CAACE,GAAL,CAASP,CAAC,GAAGD,MAAM,CAACC,CAApB,EAAuB,CAAvB,IAA4BK,IAAI,CAACE,GAAL,CAASN,CAAC,GAAGF,MAAM,CAACE,CAApB,EAAuB,CAAvB,CADjB,CAAb;;AAIA,YAAIN,MAAM,GAAGS,IAAT,IAAiB,GAArB,EAA0B;AACxB,eAAKR,MAAL,CAAYY,IAAZ,CAAiBL,GAAG,GAAG,CAAvB,IAA4B,CAA5B;AACD,SAFD,MAEO,IAAIR,MAAM,GAAGS,IAAT,GAAgB,GAApB,EAAyB;AAC9B,eAAKR,MAAL,CAAYY,IAAZ,CAAiBL,GAAG,GAAG,CAAvB,IAA4B,OAAOR,MAAM,GAAGS,IAAhB,CAA5B;AACD;AACF,OAdD;;AAgBA,UAAI,0BAAcV,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACe,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAvCmB,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) radius, x, y\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n circle(options = {}, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n const radius =\n options.radius ||\n (this.bitmap.width > this.bitmap.height\n ? this.bitmap.height\n : this.bitmap.width) / 2;\n\n const center = {\n x: typeof options.x === 'number' ? options.x : this.bitmap.width / 2,\n y: typeof options.y === 'number' ? options.y : this.bitmap.height / 2\n };\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n const curR = Math.sqrt(\n Math.pow(x - center.x, 2) + Math.pow(y - center.y, 2)\n );\n\n if (radius - curR <= 0.0) {\n this.bitmap.data[idx + 3] = 0;\n } else if (radius - curR < 1.0) {\n this.bitmap.data[idx + 3] = 255 * (radius - curR);\n }\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"}
|
||||
12
uni_modules/UniDevTools/node_modules/@jimp/plugin-circle/index.d.ts
generated
vendored
Normal file
12
uni_modules/UniDevTools/node_modules/@jimp/plugin-circle/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import { ImageCallback } from '@jimp/core';
|
||||
|
||||
interface Circle {
|
||||
circle(options?: {
|
||||
radius: number,
|
||||
x: number,
|
||||
y: number
|
||||
}, cb?: ImageCallback<this>): this;
|
||||
circle(cb?: ImageCallback<this>): this;
|
||||
}
|
||||
|
||||
export default function(): Circle;
|
||||
38
uni_modules/UniDevTools/node_modules/@jimp/plugin-circle/package.json
generated
vendored
Normal file
38
uni_modules/UniDevTools/node_modules/@jimp/plugin-circle/package.json
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "@jimp/plugin-circle",
|
||||
"version": "0.10.3",
|
||||
"description": "Creates a circle out of 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"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@jimp/custom": "^0.10.3",
|
||||
"@jimp/test-utils": "^0.10.3"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "37197106eae5c26231018dfdc0254422f6b43927"
|
||||
}
|
||||
49
uni_modules/UniDevTools/node_modules/@jimp/plugin-circle/src/index.js
generated
vendored
Normal file
49
uni_modules/UniDevTools/node_modules/@jimp/plugin-circle/src/index.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
import { isNodePattern } from '@jimp/utils';
|
||||
|
||||
/**
|
||||
* Creates a circle out of an image.
|
||||
* @param {function(Error, Jimp)} options (optional) radius, x, y
|
||||
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
|
||||
* @returns {Jimp} this for chaining of methods
|
||||
*/
|
||||
export default () => ({
|
||||
circle(options = {}, cb) {
|
||||
if (typeof options === 'function') {
|
||||
cb = options;
|
||||
options = {};
|
||||
}
|
||||
|
||||
const radius =
|
||||
options.radius ||
|
||||
(this.bitmap.width > this.bitmap.height
|
||||
? this.bitmap.height
|
||||
: this.bitmap.width) / 2;
|
||||
|
||||
const center = {
|
||||
x: typeof options.x === 'number' ? options.x : this.bitmap.width / 2,
|
||||
y: typeof options.y === 'number' ? options.y : this.bitmap.height / 2
|
||||
};
|
||||
|
||||
this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(
|
||||
x,
|
||||
y,
|
||||
idx
|
||||
) {
|
||||
const curR = Math.sqrt(
|
||||
Math.pow(x - center.x, 2) + Math.pow(y - center.y, 2)
|
||||
);
|
||||
|
||||
if (radius - curR <= 0.0) {
|
||||
this.bitmap.data[idx + 3] = 0;
|
||||
} else if (radius - curR < 1.0) {
|
||||
this.bitmap.data[idx + 3] = 255 * (radius - curR);
|
||||
}
|
||||
});
|
||||
|
||||
if (isNodePattern(cb)) {
|
||||
cb.call(this, null, this);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
||||
78
uni_modules/UniDevTools/node_modules/@jimp/plugin-circle/test/circle.test.js
generated
vendored
Normal file
78
uni_modules/UniDevTools/node_modules/@jimp/plugin-circle/test/circle.test.js
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
import { Jimp, mkJGD, getTestDir } from '@jimp/test-utils';
|
||||
import configure from '@jimp/custom';
|
||||
|
||||
import circle from '../src';
|
||||
|
||||
const jimp = configure({ plugins: [circle] }, Jimp);
|
||||
|
||||
describe('Circle', () => {
|
||||
it('makes a circle based on image height and width', async () => {
|
||||
const expectedImg = await Jimp.read(
|
||||
getTestDir(__dirname) + '/images/circled.png'
|
||||
);
|
||||
const imgSrc = await jimp.read(
|
||||
mkJGD(
|
||||
'▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
|
||||
'▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
|
||||
'▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
|
||||
'▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
|
||||
'▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
|
||||
'▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
|
||||
'▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
|
||||
'▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
|
||||
'▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
|
||||
'▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦'
|
||||
)
|
||||
);
|
||||
|
||||
imgSrc.circle().bitmap.data.should.be.deepEqual(expectedImg.bitmap.data);
|
||||
});
|
||||
|
||||
it('makes a circle using provided radius', async () => {
|
||||
const expectedImg = await Jimp.read(
|
||||
getTestDir(__dirname) + '/images/radius-3-circle.png'
|
||||
);
|
||||
const imgSrc = await jimp.read(
|
||||
mkJGD(
|
||||
'▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
|
||||
'▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
|
||||
'▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
|
||||
'▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
|
||||
'▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
|
||||
'▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
|
||||
'▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
|
||||
'▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
|
||||
'▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
|
||||
'▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦'
|
||||
)
|
||||
);
|
||||
|
||||
imgSrc
|
||||
.circle({ radius: 3 })
|
||||
.bitmap.data.should.be.deepEqual(expectedImg.bitmap.data);
|
||||
});
|
||||
|
||||
it('should ', async () => {
|
||||
const expectedImg = await Jimp.read(
|
||||
getTestDir(__dirname) + '/images/x-y-circle.png'
|
||||
);
|
||||
const imgSrc = await jimp.read(
|
||||
mkJGD(
|
||||
'▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
|
||||
'▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
|
||||
'▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
|
||||
'▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
|
||||
'▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
|
||||
'▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
|
||||
'▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
|
||||
'▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
|
||||
'▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦',
|
||||
'▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦'
|
||||
)
|
||||
);
|
||||
|
||||
imgSrc
|
||||
.circle({ radius: 5, x: 5, y: 5 })
|
||||
.bitmap.data.should.be.deepEqual(expectedImg.bitmap.data);
|
||||
});
|
||||
});
|
||||
BIN
uni_modules/UniDevTools/node_modules/@jimp/plugin-circle/test/images/circled.png
generated
vendored
Normal file
BIN
uni_modules/UniDevTools/node_modules/@jimp/plugin-circle/test/images/circled.png
generated
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 177 B |
BIN
uni_modules/UniDevTools/node_modules/@jimp/plugin-circle/test/images/radius-3-circle.png
generated
vendored
Normal file
BIN
uni_modules/UniDevTools/node_modules/@jimp/plugin-circle/test/images/radius-3-circle.png
generated
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 141 B |
BIN
uni_modules/UniDevTools/node_modules/@jimp/plugin-circle/test/images/x-y-circle.png
generated
vendored
Normal file
BIN
uni_modules/UniDevTools/node_modules/@jimp/plugin-circle/test/images/x-y-circle.png
generated
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 180 B |
Reference in New Issue
Block a user