Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MR414N-ID
GitHub Repository: MR414N-ID/botku2
Path: blob/master/node_modules/@jimp/plugin-invert/es/index.js
1126 views
1
"use strict";
2
3
Object.defineProperty(exports, "__esModule", {
4
value: true
5
});
6
exports["default"] = void 0;
7
8
var _utils = require("@jimp/utils");
9
10
/**
11
* Inverts the image
12
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
13
* @returns {Jimp} this for chaining of methods
14
*/
15
var _default = function _default() {
16
return {
17
invert: function invert(cb) {
18
this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
19
this.bitmap.data[idx] = 255 - this.bitmap.data[idx];
20
this.bitmap.data[idx + 1] = 255 - this.bitmap.data[idx + 1];
21
this.bitmap.data[idx + 2] = 255 - this.bitmap.data[idx + 2];
22
});
23
24
if ((0, _utils.isNodePattern)(cb)) {
25
cb.call(this, null, this);
26
}
27
28
return this;
29
}
30
};
31
};
32
33
exports["default"] = _default;
34
//# sourceMappingURL=index.js.map
35