imagescript 3.1.0 → 3.2.1
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/README.md +12 -4
- package/dist/animation.d.ts +92 -7
- package/dist/animation.js +50 -20
- package/dist/codecs/exif.js +62 -0
- package/dist/codecs/gif.js +43 -27
- package/dist/codecs/jpeg.js +13 -1
- package/dist/codecs/png.js +85 -21
- package/dist/codecs/quantize.js +2 -2
- package/dist/codecs/tga.js +47 -4
- package/dist/codecs/vp8l.js +27 -30
- package/dist/codecs/webp.js +23 -10
- package/dist/frame.d.ts +30 -2
- package/dist/frame.js +20 -9
- package/dist/gif.d.ts +10 -7
- package/dist/gif.js +7 -5
- package/dist/image-type.d.ts +1 -0
- package/dist/image-type.js +1 -0
- package/dist/image.d.ts +231 -31
- package/dist/image.js +118 -53
- package/dist/index.d.ts +14 -4
- package/dist/index.js +6 -4
- package/dist/metadata.d.ts +35 -0
- package/dist/metadata.js +43 -0
- package/dist/render/svg.js +39 -21
- package/dist/util/blur.js +88 -0
- package/dist/util/optimize.js +264 -0
- package/dist/util/options.js +3 -0
- package/dist/util/resample.js +244 -63
- package/dist/util/utf8.js +4 -51
- package/dist/version.js +1 -1
- package/package.json +9 -2
- package/dist/codecs/crc.d.ts +0 -9
- package/dist/codecs/exif.d.ts +0 -11
- package/dist/codecs/gif.d.ts +0 -44
- package/dist/codecs/jpeg.d.ts +0 -35
- package/dist/codecs/png.d.ts +0 -97
- package/dist/codecs/quantize.d.ts +0 -25
- package/dist/codecs/tga.d.ts +0 -16
- package/dist/codecs/tiff.d.ts +0 -6
- package/dist/codecs/vp8-tables.d.ts +0 -10
- package/dist/codecs/vp8.d.ts +0 -8
- package/dist/codecs/vp8l.d.ts +0 -62
- package/dist/codecs/webp.d.ts +0 -67
- package/dist/codecs/zlib.d.ts +0 -22
- package/dist/render/font.d.ts +0 -92
- package/dist/render/hinting.d.ts +0 -110
- package/dist/render/svg.d.ts +0 -11
- package/dist/render/text.d.ts +0 -63
- package/dist/util/blur.d.ts +0 -13
- package/dist/util/resample.d.ts +0 -12
- package/dist/util/utf8.d.ts +0 -5
- package/dist/version.d.ts +0 -1
package/dist/render/text.d.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* The Rasterizer class is translated from font-rs (https://github.com/raphlinus/font-rs)
|
|
3
|
-
* Copyright 2015 Google Inc., Apache License 2.0 (see THIRD_PARTY_NOTICES.md and licenses/Apache-2.0.txt)
|
|
4
|
-
*/
|
|
5
|
-
import { PathCommand } from './font.js';
|
|
6
|
-
export interface Layout {
|
|
7
|
-
maxWidth: number;
|
|
8
|
-
maxHeight: number;
|
|
9
|
-
wrapStyle: 'word' | 'char';
|
|
10
|
-
horizontalAlign: 'left' | 'center' | 'right';
|
|
11
|
-
verticalAlign: 'top' | 'middle' | 'bottom';
|
|
12
|
-
wrapHardBreaks: boolean;
|
|
13
|
-
}
|
|
14
|
-
export interface GlyphBitmap {
|
|
15
|
-
data: Uint8Array;
|
|
16
|
-
width: number;
|
|
17
|
-
height: number;
|
|
18
|
-
/** offset from the pen position */
|
|
19
|
-
left: number;
|
|
20
|
-
/** offset above the baseline */
|
|
21
|
-
top: number;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Lays out and rasterizes text
|
|
25
|
-
* Lines start at ceil(ascender) and advance by ceil(ascender - descender + lineGap); glyphs are placed with
|
|
26
|
-
* subpixel precision using their advance widths and the font's kerning; the canvas spans from the origin to the
|
|
27
|
-
* furthest glyph edge
|
|
28
|
-
* @param {Uint8Array} data TrueType/OpenType font
|
|
29
|
-
* @param {number} size font size in pixels per em
|
|
30
|
-
* @param {string} text
|
|
31
|
-
* @param {Layout} layout
|
|
32
|
-
* @param hinting Whether to run TrueType fonts' hinting instructions, the glyphs of hinted fonts are then placed on
|
|
33
|
-
* whole pixels (fonts without instructions render as without hinting)
|
|
34
|
-
* @return {{width: number, height: number, coverage: Uint8Array}}
|
|
35
|
-
*/
|
|
36
|
-
export declare function render(data: Uint8Array, size: number, text: string, layout: Layout, hinting?: boolean): {
|
|
37
|
-
width: number;
|
|
38
|
-
height: number;
|
|
39
|
-
coverage: Uint8Array;
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* Rasterizes a glyph outline into an 8-bit coverage bitmap
|
|
43
|
-
* @param {Array} path outline in font units (y up)
|
|
44
|
-
* @param {number} scale pixels per font unit
|
|
45
|
-
* @param {number} [offset=0] horizontal subpixel offset
|
|
46
|
-
* @return {{data: Uint8Array, width: number, height: number, left: number, top: number}|null}
|
|
47
|
-
* left/top position the bitmap relative to the pen position on the baseline (top is measured upwards)
|
|
48
|
-
*/
|
|
49
|
-
export declare function rasterizeGlyph(path: PathCommand[], scale: number, offset?: number): GlyphBitmap | null;
|
|
50
|
-
/**
|
|
51
|
-
* Signed area coverage rasterizer: every line segment adds its area to an accumulation buffer,
|
|
52
|
-
* a prefix sum over each row yields the coverage
|
|
53
|
-
*/
|
|
54
|
-
export declare class Rasterizer {
|
|
55
|
-
width: number;
|
|
56
|
-
height: number;
|
|
57
|
-
accumulation: Float32Array;
|
|
58
|
-
constructor(width: number, height: number);
|
|
59
|
-
line(x0: number, y0: number, x1: number, y1: number): void;
|
|
60
|
-
quad(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number): void;
|
|
61
|
-
cubic(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number): void;
|
|
62
|
-
coverage(): Uint8Array;
|
|
63
|
-
}
|
package/dist/util/blur.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Blurs premultiplied RGBA float pixels in place
|
|
3
|
-
* @param sigma standard deviation of the gaussian in pixels
|
|
4
|
-
*/
|
|
5
|
-
export declare function gaussianBlur(pixels: Float32Array, width: number, height: number, sigma: number): void;
|
|
6
|
-
/**
|
|
7
|
-
* Converts 8-bit RGBA to premultiplied floats
|
|
8
|
-
*/
|
|
9
|
-
export declare function premultiply(rgba: Uint8ClampedArray): Float32Array;
|
|
10
|
-
/**
|
|
11
|
-
* Converts premultiplied floats back to 8-bit RGBA (the clamped output rounds)
|
|
12
|
-
*/
|
|
13
|
-
export declare function unpremultiply(pixels: Float32Array, out: Uint8ClampedArray): void;
|
package/dist/util/resample.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export interface Filter {
|
|
2
|
-
/** radius of the filter at scale 1 */
|
|
3
|
-
support: number;
|
|
4
|
-
weight: (x: number) => number;
|
|
5
|
-
}
|
|
6
|
-
export declare const BOX: Filter;
|
|
7
|
-
export declare const TRIANGLE: Filter;
|
|
8
|
-
export declare const CUBIC: Filter;
|
|
9
|
-
/**
|
|
10
|
-
* Resamples RGBA pixels with the given filter, in premultiplied alpha so transparent pixels don't bleed their color
|
|
11
|
-
*/
|
|
12
|
-
export declare function resample(src: Uint8ClampedArray, width: number, height: number, outWidth: number, outHeight: number, filter: Filter, out: Uint8ClampedArray): void;
|
package/dist/util/utf8.d.ts
DELETED
package/dist/version.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const VERSION = "3.1.0";
|