-
Notifications
You must be signed in to change notification settings - Fork 60
/
index.d.ts
109 lines (107 loc) · 2.44 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
// Generated by dts-bundle-generator v9.5.1
declare class BBox {
free(): void;
/**
*/
height: number;
/**
*/
width: number;
/**
*/
x: number;
/**
*/
y: number;
}
declare class RenderedImage {
free(): void;
/**
* Write the image data to Uint8Array
* @returns {Uint8Array}
*/
asPng(): Uint8Array;
/**
* Get the PNG height
*/
readonly height: number;
/**
* Get the RGBA pixels of the image
*/
readonly pixels: Uint8Array;
/**
* Get the PNG width
*/
readonly width: number;
}
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
export type ResvgRenderOptions = {
font?: SystemFontsOptions | CustomFontsOptions;
dpi?: number;
languages?: string[];
shapeRendering?: 0 // optimizeSpeed
| 1 // crispEdges
| 2; // geometricPrecision
textRendering?: 0 // optimizeSpeed
| 1 // optimizeLegibility
| 2; // geometricPrecision'
imageRendering?: 0 // optimizeQuality
| 1; // optimizeSpeed
fitTo?: {
mode: "original";
} | {
mode: "width";
value: number;
} | {
mode: "height";
value: number;
} | {
mode: "zoom";
value: number;
};
background?: string; // Support CSS3 color, e.g. rgba(255, 255, 255, .8)
crop?: {
left: number;
top: number;
right?: number;
bottom?: number;
};
};
export type FontOptions = {
defaultFontSize?: number; // Default: 12
defaultFontFamily?: string;
serifFamily?: string;
sansSerifFamily?: string;
cursiveFamily?: string;
fantasyFamily?: string;
monospaceFamily?: string;
};
export type CustomFontsOptions = {
fontBuffers: Uint8Array[]; // A list of raw font buffers to load.
} & FontOptions;
export type SystemFontsOptions = {
loadSystemFonts?: boolean; // Default: true. if set to false, it will be faster.
fontFiles?: string[]; // A list of local font file paths to load.
fontDirs?: string[]; // A list of local font directories to load.
} & FontOptions;
/**
* Initialize Wasm module
* @param module_or_path WebAssembly Module or .wasm url
*
*/
export declare const initWasm: (module_or_path: Promise<InitInput> | InitInput) => Promise<void>;
export declare const Resvg: {
new (svg: Uint8Array | string, options?: ResvgRenderOptions): {
free(): void;
render(): RenderedImage;
toString(): string;
innerBBox(): BBox | undefined;
getBBox(): BBox | undefined;
cropByBBox(bbox: BBox): void;
imagesToResolve(): any[];
resolveImage(href: string, buffer: Uint8Array): void;
readonly height: number;
readonly width: number;
};
};
export {};