Spaces:
Sleeping
Sleeping
File size: 3,179 Bytes
04f98c3 |
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 |
import { RenderingContext2D } from './types';
import Parser, { IParserOptions } from './Parser';
import Screen, { IScreenOptions, IScreenStartOptions } from './Screen';
import Document, { IDocumentOptions } from './Document';
declare type DOMDocument = typeof window.document;
export interface IOptions extends IParserOptions, IScreenOptions, IScreenStartOptions, IDocumentOptions {
}
/**
* SVG renderer on canvas.
*/
export default class Canvg {
/**
* Create Canvg instance from SVG source string or URL.
* @param ctx - Rendering context.
* @param svg - SVG source string or URL.
* @param options - Rendering options.
* @returns Canvg instance.
*/
static from(ctx: RenderingContext2D, svg: string, options?: IOptions): Promise<Canvg>;
/**
* Create Canvg instance from SVG source string.
* @param ctx - Rendering context.
* @param svg - SVG source string.
* @param options - Rendering options.
* @returns Canvg instance.
*/
static fromString(ctx: RenderingContext2D, svg: string, options?: IOptions): Canvg;
/**
* XML/HTML parser instance.
*/
readonly parser: Parser;
/**
* Screen instance.
*/
readonly screen: Screen;
/**
* Canvg Document.
*/
readonly document: Document;
private readonly documentElement;
private readonly options;
/**
* Main constructor.
* @param ctx - Rendering context.
* @param svg - SVG Document.
* @param options - Rendering options.
*/
constructor(ctx: RenderingContext2D, svg: DOMDocument, options?: IOptions);
/**
* Create new Canvg instance with inherited options.
* @param ctx - Rendering context.
* @param svg - SVG source string or URL.
* @param options - Rendering options.
* @returns Canvg instance.
*/
fork(ctx: RenderingContext2D, svg: string, options?: IOptions): Promise<Canvg>;
/**
* Create new Canvg instance with inherited options.
* @param ctx - Rendering context.
* @param svg - SVG source string.
* @param options - Rendering options.
* @returns Canvg instance.
*/
forkString(ctx: RenderingContext2D, svg: string, options?: IOptions): Canvg;
/**
* Document is ready promise.
* @returns Ready promise.
*/
ready(): Promise<void>;
/**
* Document is ready value.
* @returns Is ready or not.
*/
isReady(): boolean;
/**
* Render only first frame, ignoring animations and mouse.
* @param options - Rendering options.
*/
render(options?: IScreenStartOptions): Promise<void>;
/**
* Start rendering.
* @param options - Render options.
*/
start(options?: IScreenStartOptions): void;
/**
* Stop rendering.
*/
stop(): void;
/**
* Resize SVG to fit in given size.
* @param width
* @param height
* @param preserveAspectRatio
*/
resize(width: number, height?: number, preserveAspectRatio?: boolean | string): void;
}
export {};
//# sourceMappingURL=Canvg.d.ts.map |