imagescript 1.2.17 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ImageScript.d.ts +4 -2
- package/ImageScript.js +12 -1
- package/package.json +1 -1
- package/v2/codecs/magic.js +1 -1
- package/v2/index.js +2 -2
package/ImageScript.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export class Image {
|
|
|
17
17
|
* [Symbol.iterator](): void;
|
|
18
18
|
|
|
19
19
|
* iterateWithColors(): Generator<[x: number, y: number, color: number], void, unknown>;
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
static rgbaToColor(r: number, g: number, b: number, a: number): number;
|
|
22
22
|
|
|
23
23
|
static rgbToColor(r: number, g: number, b: number): number;
|
|
@@ -112,6 +112,8 @@ export class Image {
|
|
|
112
112
|
|
|
113
113
|
rotate(angle: number, resize?: boolean): Image;
|
|
114
114
|
|
|
115
|
+
flip(direction: 'horizontal' | 'vertical'): Image;
|
|
116
|
+
|
|
115
117
|
private __apply__(image: Image | Frame): Image | Frame;
|
|
116
118
|
|
|
117
119
|
static gradient(colors: { [position: number]: number; }): ((position: number) => number);
|
|
@@ -162,7 +164,7 @@ export class Frame extends Image {
|
|
|
162
164
|
get disposalMode(): number;
|
|
163
165
|
|
|
164
166
|
set disposalMode(disposalMode: string|number);
|
|
165
|
-
|
|
167
|
+
|
|
166
168
|
toString(): string;
|
|
167
169
|
|
|
168
170
|
static from(image: Image, duration?: number, xOffset?: number, yOffset?: number, disposalMode?: typeof Frame.DISPOSAL_KEEP | string): Frame;
|
package/ImageScript.js
CHANGED
|
@@ -829,6 +829,17 @@ class Image {
|
|
|
829
829
|
return this.__apply__(out);
|
|
830
830
|
}
|
|
831
831
|
|
|
832
|
+
/**
|
|
833
|
+
* Flips / mirrors the image horizontally or vertically
|
|
834
|
+
* @param {'horizontal' | 'vertical'} direction The direction to flip
|
|
835
|
+
*/
|
|
836
|
+
flip(direction) {
|
|
837
|
+
const frame = new v2(this.width, this.height, this.bitmap).flip(direction);
|
|
838
|
+
|
|
839
|
+
this.bitmap.set(frame.u8);
|
|
840
|
+
return this;
|
|
841
|
+
}
|
|
842
|
+
|
|
832
843
|
/**
|
|
833
844
|
* @private
|
|
834
845
|
* @param {Image|Frame} image
|
|
@@ -1336,7 +1347,7 @@ class GIF extends Array {
|
|
|
1336
1347
|
/**
|
|
1337
1348
|
* Creates a new GIF image.
|
|
1338
1349
|
* @param {Frame[]} frames The frames to create the GIF from
|
|
1339
|
-
* @param {number} [loopCount
|
|
1350
|
+
* @param {number} [loopCount=-1] How often to loop the GIF for (-1 = unlimited)
|
|
1340
1351
|
* @property {number} loopCount How often the GIF will loop for
|
|
1341
1352
|
*/
|
|
1342
1353
|
constructor(frames, loopCount = -1) {
|
package/package.json
CHANGED
package/v2/codecs/magic.js
CHANGED
package/v2/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const mem = require('
|
|
1
|
+
const mem = require('../utils/mem.js');
|
|
2
2
|
const png = require('../png/node.js');
|
|
3
3
|
const magic = require('./codecs/magic.js');
|
|
4
4
|
const codecs = require('../codecs/node/index.js');
|
|
@@ -258,4 +258,4 @@ class Animation {
|
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
260
|
|
|
261
|
-
module.exports = { load, Image, Frame, Color, Animation };
|
|
261
|
+
module.exports = { load, Image, Frame, Color, Animation };
|