yeet
This commit is contained in:
35
node_modules/@jimp/plugin-flip/CHANGELOG.md
generated
vendored
Normal file
35
node_modules/@jimp/plugin-flip/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
# v0.11.0 (Fri May 15 2020)
|
||||
|
||||
#### 🚀 Enhancement
|
||||
|
||||
- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil))
|
||||
|
||||
#### Authors: 1
|
||||
|
||||
- Eric Rabil ([@EricRabil](https://github.com/EricRabil))
|
||||
|
||||
---
|
||||
|
||||
# v0.10.3 (Mon Apr 20 2020)
|
||||
|
||||
#### 🐛 Bug Fix
|
||||
|
||||
- Simplify and fix flip [#879](https://github.com/oliver-moran/jimp/pull/879) ([@skalee](https://github.com/skalee))
|
||||
|
||||
#### Authors: 1
|
||||
|
||||
- Sebastian Skałacki ([@skalee](https://github.com/skalee))
|
||||
|
||||
---
|
||||
|
||||
# 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
node_modules/@jimp/plugin-flip/LICENSE
generated
vendored
Normal file
21
node_modules/@jimp/plugin-flip/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
node_modules/@jimp/plugin-flip/README.md
generated
vendored
Normal file
30
node_modules/@jimp/plugin-flip/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-flip</h1>
|
||||
<p>flip an image.</p>
|
||||
</div>
|
||||
|
||||
Flip the image horizontally or vertically. Defaults to horizontal.
|
||||
|
||||
Also aliased as `mirror`
|
||||
|
||||
## Usage
|
||||
|
||||
- @param {boolean} horizontal a Boolean, if true the image will be flipped horizontally
|
||||
- @param {boolean} vertical a Boolean, if true the image will be flipped vertically
|
||||
- @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.flip();
|
||||
image.mirror();
|
||||
image.flip(false, true);
|
||||
}
|
||||
|
||||
main();
|
||||
```
|
48
node_modules/@jimp/plugin-flip/dist/index.js
generated
vendored
Normal file
48
node_modules/@jimp/plugin-flip/dist/index.js
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _utils = require("@jimp/utils");
|
||||
|
||||
/**
|
||||
* Flip the image horizontally
|
||||
* @param {boolean} horizontal a Boolean, if true the image will be flipped horizontally
|
||||
* @param {boolean} vertical a Boolean, if true the image will be flipped vertically
|
||||
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
|
||||
* @returns {Jimp} this for chaining of methods
|
||||
*/
|
||||
function flipFn(horizontal, vertical, cb) {
|
||||
if (typeof horizontal !== 'boolean' || typeof vertical !== 'boolean') return _utils.throwError.call(this, 'horizontal and vertical must be Booleans', cb);
|
||||
var bitmap = Buffer.alloc(this.bitmap.data.length);
|
||||
this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
|
||||
var _x = horizontal ? this.bitmap.width - 1 - x : x;
|
||||
|
||||
var _y = vertical ? this.bitmap.height - 1 - y : y;
|
||||
|
||||
var _idx = this.bitmap.width * _y + _x << 2;
|
||||
|
||||
var data = this.bitmap.data.readUInt32BE(idx);
|
||||
bitmap.writeUInt32BE(data, _idx);
|
||||
});
|
||||
this.bitmap.data = Buffer.from(bitmap);
|
||||
|
||||
if ((0, _utils.isNodePattern)(cb)) {
|
||||
cb.call(this, null, this);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
var _default = function _default() {
|
||||
return {
|
||||
flip: flipFn,
|
||||
mirror: flipFn
|
||||
};
|
||||
};
|
||||
|
||||
exports["default"] = _default;
|
||||
module.exports = exports.default;
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/@jimp/plugin-flip/dist/index.js.map
generated
vendored
Normal file
1
node_modules/@jimp/plugin-flip/dist/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/index.js"],"names":["flipFn","horizontal","vertical","cb","throwError","call","bitmap","Buffer","alloc","data","length","scanQuiet","width","height","x","y","idx","_x","_y","_idx","readUInt32BE","writeUInt32BE","from","flip","mirror"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;AAOA,SAASA,MAAT,CAAgBC,UAAhB,EAA4BC,QAA5B,EAAsCC,EAAtC,EAA0C;AACxC,MAAI,OAAOF,UAAP,KAAsB,SAAtB,IAAmC,OAAOC,QAAP,KAAoB,SAA3D,EACE,OAAOE,kBAAWC,IAAX,CACL,IADK,EAEL,0CAFK,EAGLF,EAHK,CAAP;AAMF,MAAMG,MAAM,GAAGC,MAAM,CAACC,KAAP,CAAa,KAAKF,MAAL,CAAYG,IAAZ,CAAiBC,MAA9B,CAAf;AACA,OAAKC,SAAL,CAAe,CAAf,EAAkB,CAAlB,EAAqB,KAAKL,MAAL,CAAYM,KAAjC,EAAwC,KAAKN,MAAL,CAAYO,MAApD,EAA4D,UAC1DC,CAD0D,EAE1DC,CAF0D,EAG1DC,GAH0D,EAI1D;AACA,QAAMC,EAAE,GAAGhB,UAAU,GAAG,KAAKK,MAAL,CAAYM,KAAZ,GAAoB,CAApB,GAAwBE,CAA3B,GAA+BA,CAApD;;AACA,QAAMI,EAAE,GAAGhB,QAAQ,GAAG,KAAKI,MAAL,CAAYO,MAAZ,GAAqB,CAArB,GAAyBE,CAA5B,GAAgCA,CAAnD;;AACA,QAAMI,IAAI,GAAI,KAAKb,MAAL,CAAYM,KAAZ,GAAoBM,EAApB,GAAyBD,EAA1B,IAAiC,CAA9C;;AACA,QAAMR,IAAI,GAAG,KAAKH,MAAL,CAAYG,IAAZ,CAAiBW,YAAjB,CAA8BJ,GAA9B,CAAb;AAEAV,IAAAA,MAAM,CAACe,aAAP,CAAqBZ,IAArB,EAA2BU,IAA3B;AACD,GAXD;AAaA,OAAKb,MAAL,CAAYG,IAAZ,GAAmBF,MAAM,CAACe,IAAP,CAAYhB,MAAZ,CAAnB;;AAEA,MAAI,0BAAcH,EAAd,CAAJ,EAAuB;AACrBA,IAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,SAAO,IAAP;AACD;;eAEc;AAAA,SAAO;AACpBkB,IAAAA,IAAI,EAAEvB,MADc;AAEpBwB,IAAAA,MAAM,EAAExB;AAFY,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Flip the image horizontally\n * @param {boolean} horizontal a Boolean, if true the image will be flipped horizontally\n * @param {boolean} vertical a Boolean, if true the image will be flipped vertically\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nfunction flipFn(horizontal, vertical, cb) {\n if (typeof horizontal !== 'boolean' || typeof vertical !== 'boolean')\n return throwError.call(\n this,\n 'horizontal and vertical must be Booleans',\n cb\n );\n\n const bitmap = Buffer.alloc(this.bitmap.data.length);\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n const _x = horizontal ? this.bitmap.width - 1 - x : x;\n const _y = vertical ? this.bitmap.height - 1 - y : y;\n const _idx = (this.bitmap.width * _y + _x) << 2;\n const data = this.bitmap.data.readUInt32BE(idx);\n\n bitmap.writeUInt32BE(data, _idx);\n });\n\n this.bitmap.data = Buffer.from(bitmap);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nexport default () => ({\n flip: flipFn,\n mirror: flipFn\n});\n"],"file":"index.js"}
|
47
node_modules/@jimp/plugin-flip/es/index.js
generated
vendored
Normal file
47
node_modules/@jimp/plugin-flip/es/index.js
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _utils = require("@jimp/utils");
|
||||
|
||||
/**
|
||||
* Flip the image horizontally
|
||||
* @param {boolean} horizontal a Boolean, if true the image will be flipped horizontally
|
||||
* @param {boolean} vertical a Boolean, if true the image will be flipped vertically
|
||||
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
|
||||
* @returns {Jimp} this for chaining of methods
|
||||
*/
|
||||
function flipFn(horizontal, vertical, cb) {
|
||||
if (typeof horizontal !== 'boolean' || typeof vertical !== 'boolean') return _utils.throwError.call(this, 'horizontal and vertical must be Booleans', cb);
|
||||
var bitmap = Buffer.alloc(this.bitmap.data.length);
|
||||
this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
|
||||
var _x = horizontal ? this.bitmap.width - 1 - x : x;
|
||||
|
||||
var _y = vertical ? this.bitmap.height - 1 - y : y;
|
||||
|
||||
var _idx = this.bitmap.width * _y + _x << 2;
|
||||
|
||||
var data = this.bitmap.data.readUInt32BE(idx);
|
||||
bitmap.writeUInt32BE(data, _idx);
|
||||
});
|
||||
this.bitmap.data = Buffer.from(bitmap);
|
||||
|
||||
if ((0, _utils.isNodePattern)(cb)) {
|
||||
cb.call(this, null, this);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
var _default = function _default() {
|
||||
return {
|
||||
flip: flipFn,
|
||||
mirror: flipFn
|
||||
};
|
||||
};
|
||||
|
||||
exports["default"] = _default;
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/@jimp/plugin-flip/es/index.js.map
generated
vendored
Normal file
1
node_modules/@jimp/plugin-flip/es/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/index.js"],"names":["flipFn","horizontal","vertical","cb","throwError","call","bitmap","Buffer","alloc","data","length","scanQuiet","width","height","x","y","idx","_x","_y","_idx","readUInt32BE","writeUInt32BE","from","flip","mirror"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;AAOA,SAASA,MAAT,CAAgBC,UAAhB,EAA4BC,QAA5B,EAAsCC,EAAtC,EAA0C;AACxC,MAAI,OAAOF,UAAP,KAAsB,SAAtB,IAAmC,OAAOC,QAAP,KAAoB,SAA3D,EACE,OAAOE,kBAAWC,IAAX,CACL,IADK,EAEL,0CAFK,EAGLF,EAHK,CAAP;AAMF,MAAMG,MAAM,GAAGC,MAAM,CAACC,KAAP,CAAa,KAAKF,MAAL,CAAYG,IAAZ,CAAiBC,MAA9B,CAAf;AACA,OAAKC,SAAL,CAAe,CAAf,EAAkB,CAAlB,EAAqB,KAAKL,MAAL,CAAYM,KAAjC,EAAwC,KAAKN,MAAL,CAAYO,MAApD,EAA4D,UAC1DC,CAD0D,EAE1DC,CAF0D,EAG1DC,GAH0D,EAI1D;AACA,QAAMC,EAAE,GAAGhB,UAAU,GAAG,KAAKK,MAAL,CAAYM,KAAZ,GAAoB,CAApB,GAAwBE,CAA3B,GAA+BA,CAApD;;AACA,QAAMI,EAAE,GAAGhB,QAAQ,GAAG,KAAKI,MAAL,CAAYO,MAAZ,GAAqB,CAArB,GAAyBE,CAA5B,GAAgCA,CAAnD;;AACA,QAAMI,IAAI,GAAI,KAAKb,MAAL,CAAYM,KAAZ,GAAoBM,EAApB,GAAyBD,EAA1B,IAAiC,CAA9C;;AACA,QAAMR,IAAI,GAAG,KAAKH,MAAL,CAAYG,IAAZ,CAAiBW,YAAjB,CAA8BJ,GAA9B,CAAb;AAEAV,IAAAA,MAAM,CAACe,aAAP,CAAqBZ,IAArB,EAA2BU,IAA3B;AACD,GAXD;AAaA,OAAKb,MAAL,CAAYG,IAAZ,GAAmBF,MAAM,CAACe,IAAP,CAAYhB,MAAZ,CAAnB;;AAEA,MAAI,0BAAcH,EAAd,CAAJ,EAAuB;AACrBA,IAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,SAAO,IAAP;AACD;;eAEc;AAAA,SAAO;AACpBkB,IAAAA,IAAI,EAAEvB,MADc;AAEpBwB,IAAAA,MAAM,EAAExB;AAFY,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Flip the image horizontally\n * @param {boolean} horizontal a Boolean, if true the image will be flipped horizontally\n * @param {boolean} vertical a Boolean, if true the image will be flipped vertically\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nfunction flipFn(horizontal, vertical, cb) {\n if (typeof horizontal !== 'boolean' || typeof vertical !== 'boolean')\n return throwError.call(\n this,\n 'horizontal and vertical must be Booleans',\n cb\n );\n\n const bitmap = Buffer.alloc(this.bitmap.data.length);\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n const _x = horizontal ? this.bitmap.width - 1 - x : x;\n const _y = vertical ? this.bitmap.height - 1 - y : y;\n const _idx = (this.bitmap.width * _y + _x) << 2;\n const data = this.bitmap.data.readUInt32BE(idx);\n\n bitmap.writeUInt32BE(data, _idx);\n });\n\n this.bitmap.data = Buffer.from(bitmap);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nexport default () => ({\n flip: flipFn,\n mirror: flipFn\n});\n"],"file":"index.js"}
|
8
node_modules/@jimp/plugin-flip/index.d.ts
generated
vendored
Normal file
8
node_modules/@jimp/plugin-flip/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
import { ImageCallback } from '@jimp/core';
|
||||
|
||||
interface Flip {
|
||||
flip(horizontal: boolean, vertical: boolean, cb?: ImageCallback<this>): this;
|
||||
mirror(horizontal: boolean, vertical: boolean, cb?: ImageCallback<this>): this;
|
||||
}
|
||||
|
||||
export default function(): Flip;
|
31
node_modules/@jimp/plugin-flip/package.json
generated
vendored
Normal file
31
node_modules/@jimp/plugin-flip/package.json
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "@jimp/plugin-flip",
|
||||
"version": "0.12.1",
|
||||
"description": "flip 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.12.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@jimp/custom": ">=0.3.5",
|
||||
"@jimp/plugin-rotate": ">=0.3.5"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "942e635564e36fc243767531b4f8be036afa40b5"
|
||||
}
|
44
node_modules/@jimp/plugin-flip/src/index.js
generated
vendored
Normal file
44
node_modules/@jimp/plugin-flip/src/index.js
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
import { isNodePattern, throwError } from '@jimp/utils';
|
||||
|
||||
/**
|
||||
* Flip the image horizontally
|
||||
* @param {boolean} horizontal a Boolean, if true the image will be flipped horizontally
|
||||
* @param {boolean} vertical a Boolean, if true the image will be flipped vertically
|
||||
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
|
||||
* @returns {Jimp} this for chaining of methods
|
||||
*/
|
||||
function flipFn(horizontal, vertical, cb) {
|
||||
if (typeof horizontal !== 'boolean' || typeof vertical !== 'boolean')
|
||||
return throwError.call(
|
||||
this,
|
||||
'horizontal and vertical must be Booleans',
|
||||
cb
|
||||
);
|
||||
|
||||
const bitmap = Buffer.alloc(this.bitmap.data.length);
|
||||
this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(
|
||||
x,
|
||||
y,
|
||||
idx
|
||||
) {
|
||||
const _x = horizontal ? this.bitmap.width - 1 - x : x;
|
||||
const _y = vertical ? this.bitmap.height - 1 - y : y;
|
||||
const _idx = (this.bitmap.width * _y + _x) << 2;
|
||||
const data = this.bitmap.data.readUInt32BE(idx);
|
||||
|
||||
bitmap.writeUInt32BE(data, _idx);
|
||||
});
|
||||
|
||||
this.bitmap.data = Buffer.from(bitmap);
|
||||
|
||||
if (isNodePattern(cb)) {
|
||||
cb.call(this, null, this);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
export default () => ({
|
||||
flip: flipFn,
|
||||
mirror: flipFn
|
||||
});
|
99
node_modules/@jimp/plugin-flip/test/flipping.test.js
generated
vendored
Normal file
99
node_modules/@jimp/plugin-flip/test/flipping.test.js
generated
vendored
Normal file
@ -0,0 +1,99 @@
|
||||
import { Jimp, mkJGD } from '@jimp/test-utils';
|
||||
|
||||
import configure from '@jimp/custom';
|
||||
|
||||
import flip from '../src';
|
||||
|
||||
const jimp = configure({ plugins: [flip] }, Jimp);
|
||||
|
||||
describe('Flipping plugin', () => {
|
||||
it('can flip horizontally', async () => {
|
||||
const src = await jimp.read(
|
||||
mkJGD(
|
||||
'AAAABBBB',
|
||||
'AAABAAAB',
|
||||
'ABABABAB',
|
||||
'CCCCCCCC',
|
||||
'CCCCCCCC',
|
||||
'CCCCCCCC',
|
||||
'AACCCCAA'
|
||||
)
|
||||
);
|
||||
|
||||
const result = src.flip(true, false);
|
||||
|
||||
result
|
||||
.getJGDSync()
|
||||
.should.be.sameJGD(
|
||||
mkJGD(
|
||||
'BBBBAAAA',
|
||||
'BAAABAAA',
|
||||
'BABABABA',
|
||||
'CCCCCCCC',
|
||||
'CCCCCCCC',
|
||||
'CCCCCCCC',
|
||||
'AACCCCAA'
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
it('can flip vertically', async () => {
|
||||
const src = await jimp.read(
|
||||
mkJGD(
|
||||
'AAAABBBB',
|
||||
'AAABAAAB',
|
||||
'ABABABAB',
|
||||
'CCCCCCCC',
|
||||
'CCCCCCCC',
|
||||
'CCCCCCCC',
|
||||
'AACCCCAA'
|
||||
)
|
||||
);
|
||||
|
||||
const result = src.flip(false, true);
|
||||
|
||||
result
|
||||
.getJGDSync()
|
||||
.should.be.sameJGD(
|
||||
mkJGD(
|
||||
'AACCCCAA',
|
||||
'CCCCCCCC',
|
||||
'CCCCCCCC',
|
||||
'CCCCCCCC',
|
||||
'ABABABAB',
|
||||
'AAABAAAB',
|
||||
'AAAABBBB'
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
it('can flip both horizontally and vertically at once', async () => {
|
||||
const src = await jimp.read(
|
||||
mkJGD(
|
||||
'AAAABBBB',
|
||||
'AAABAAAB',
|
||||
'ABABABAB',
|
||||
'CCCCCCCC',
|
||||
'CCCCCCCC',
|
||||
'CCCCCCCC',
|
||||
'AACCCCAA'
|
||||
)
|
||||
);
|
||||
|
||||
const result = src.flip(true, true);
|
||||
|
||||
result
|
||||
.getJGDSync()
|
||||
.should.be.sameJGD(
|
||||
mkJGD(
|
||||
'AACCCCAA',
|
||||
'CCCCCCCC',
|
||||
'CCCCCCCC',
|
||||
'CCCCCCCC',
|
||||
'BABABABA',
|
||||
'BAAABAAA',
|
||||
'BBBBAAAA'
|
||||
)
|
||||
);
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user