-
Notifications
You must be signed in to change notification settings - Fork 58
/
js-binding.d.ts
52 lines (50 loc) · 1.51 KB
/
js-binding.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
/* tslint:disable */
/* eslint-disable */
/* auto-generated by NAPI-RS */
export function renderAsync(svg: string | Buffer, options?: string | undefined | null, signal?: AbortSignal | undefined | null): Promise<RenderedImage>
export class BBox {
x: number
y: number
width: number
height: number
}
export class Resvg {
constructor(svg: string | Buffer, options?: string | undefined | null)
/** Renders an SVG in Node.js */
render(): RenderedImage
/** Output usvg-simplified SVG string */
toString(): string
/**
* Calculate a maximum bounding box of all visible elements in this SVG.
*
* Note: path bounding box are approx values.
*/
innerBBox(): BBox | undefined
/**
* Calculate a maximum bounding box of all visible elements in this SVG.
* This will first apply transform.
* Similar to `SVGGraphicsElement.getBBox()` DOM API.
*/
getBBox(): BBox | undefined
/**
* Use a given `BBox` to crop the svg. Currently this method simply changes
* the viewbox/size of the svg and do not move the elements for simplicity
*/
cropByBBox(bbox: BBox): void
imagesToResolve(): Array<string>
resolveImage(href: string, buffer: Buffer): void
/** Get the SVG width */
get width(): number
/** Get the SVG height */
get height(): number
}
export class RenderedImage {
/** Write the image data to Buffer */
asPng(): Buffer
/** Get the RGBA pixels of the image */
get pixels(): Buffer
/** Get the PNG width */
get width(): number
/** Get the PNG height */
get height(): number
}