1 | import { RenderingContext2D } from './types';
|
2 | import { IParserOptions, Parser } from './Parser';
|
3 | import { IScreenOptions, IScreenStartOptions, Screen } from './Screen';
|
4 | import { IDocumentOptions, Document } from './Document';
|
5 | type DOMDocument = typeof window.document;
|
6 | export interface IOptions extends IParserOptions, IScreenOptions, IScreenStartOptions, IDocumentOptions {
|
7 | }
|
8 |
|
9 |
|
10 |
|
11 | export declare class Canvg {
|
12 | |
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 | static from(ctx: RenderingContext2D, svg: string, options?: IOptions): Promise<Canvg>;
|
20 | |
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 | static fromString(ctx: RenderingContext2D, svg: string, options?: IOptions): Canvg;
|
28 | |
29 |
|
30 |
|
31 | readonly parser: Parser;
|
32 | |
33 |
|
34 |
|
35 | readonly screen: Screen;
|
36 | |
37 |
|
38 |
|
39 | readonly document: Document;
|
40 | private readonly documentElement;
|
41 | private readonly options;
|
42 | |
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 | constructor(ctx: RenderingContext2D, svg: DOMDocument, options?: IOptions);
|
49 | /**
|
50 | * Create new Canvg instance with inherited options.
|
51 | * @param ctx - Rendering context.
|
52 | * @param svg - SVG source string or URL.
|
53 | * @param options - Rendering options.
|
54 | * @returns Canvg instance.
|
55 | */
|
56 | fork(ctx: RenderingContext2D, svg: string, options?: IOptions): Promise<Canvg>;
|
57 | /**
|
58 | * Create new Canvg instance with inherited options.
|
59 | * @param ctx - Rendering context.
|
60 | * @param svg - SVG source string.
|
61 | * @param options - Rendering options.
|
62 | * @returns Canvg instance.
|
63 | */
|
64 | forkString(ctx: RenderingContext2D, svg: string, options?: IOptions): Canvg;
|
65 | /**
|
66 | * Document is ready promise.
|
67 | * @returns Ready promise.
|
68 | */
|
69 | ready(): Promise<void>;
|
70 | /**
|
71 | * Document is ready value.
|
72 | * @returns Is ready or not.
|
73 | */
|
74 | isReady(): boolean;
|
75 | /**
|
76 | * Render only first frame, ignoring animations and mouse.
|
77 | * @param options - Rendering options.
|
78 | */
|
79 | render(options?: IScreenStartOptions): Promise<void>;
|
80 | /**
|
81 | * Start rendering.
|
82 | * @param options - Render options.
|
83 | */
|
84 | start(options?: IScreenStartOptions): void;
|
85 | /**
|
86 | * Stop rendering.
|
87 | */
|
88 | stop(): void;
|
89 | /**
|
90 | * Resize SVG to fit in given size.
|
91 | * @param width
|
92 | * @param height
|
93 | * @param preserveAspectRatio
|
94 | */
|
95 | resize(width: number, height?: number, preserveAspectRatio?: boolean | string): void;
|
96 | }
|
97 | export {};
|
98 |
|
\ | No newline at end of file |