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