-
Notifications
You must be signed in to change notification settings - Fork 37
/
index.d.ts
55 lines (51 loc) · 1.42 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
type Callback = (err: any, buffer: any) => any;
type Format = 'jpeg' | 'jpg' | 'png';
export interface svg2imgOptions {
resvg?: ResvgRenderOptions;
format?: Format;
quality?: number;
}
// See https://github.com/yisibl/resvg-js/blob/main/index.d.ts
export type ResvgRenderOptions = {
font?: {
loadSystemFonts?: boolean
fontFiles?: string[]
fontDirs?: string[]
defaultFontFamily?: string
defaultFontSize?: number
serifFamily?: string
sansSerifFamily?: string
cursiveFamily?: string
fantasyFamily?: string
monospaceFamily?: string
}
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
}
logLevel?: 'off' | 'error' | 'warn' | 'info' | 'debug' | 'trace'
}
declare function svg2img(svg: string, options?: svg2imgOptions, callback?: Callback): void;
declare function svg2img(svg: string, callback: Callback): void;
export default svg2img;