Painter.d.ts 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import Displayable from '../graphic/Displayable';
  2. import Storage from '../Storage';
  3. import { PainterBase } from '../PainterBase';
  4. import { SVGVNode, BrushScope } from './core';
  5. import { GradientObject } from '../graphic/Gradient';
  6. import { PatternObject } from '../graphic/Pattern';
  7. interface SVGPainterOption {
  8. width?: number;
  9. height?: number;
  10. ssr?: boolean;
  11. }
  12. declare type SVGPainterBackgroundColor = string | GradientObject | PatternObject;
  13. declare class SVGPainter implements PainterBase {
  14. type: string;
  15. storage: Storage;
  16. root: HTMLElement;
  17. private _svgDom;
  18. private _viewport;
  19. private _opts;
  20. private _oldVNode;
  21. private _bgVNode;
  22. private _mainVNode;
  23. private _width;
  24. private _height;
  25. private _backgroundColor;
  26. private _id;
  27. constructor(root: HTMLElement, storage: Storage, opts: SVGPainterOption);
  28. getType(): string;
  29. getViewportRoot(): HTMLElement;
  30. getViewportRootOffset(): {
  31. offsetLeft: number;
  32. offsetTop: number;
  33. };
  34. getSvgDom(): SVGElement;
  35. refresh(): void;
  36. renderOneToVNode(el: Displayable): SVGVNode;
  37. renderToVNode(opts?: {
  38. animation?: boolean;
  39. willUpdate?: boolean;
  40. compress?: boolean;
  41. useViewBox?: boolean;
  42. emphasis?: boolean;
  43. }): SVGVNode;
  44. renderToString(opts?: {
  45. cssAnimation?: boolean;
  46. cssEmphasis?: boolean;
  47. useViewBox?: boolean;
  48. }): string;
  49. setBackgroundColor(backgroundColor: SVGPainterBackgroundColor): void;
  50. getSvgRoot(): SVGElement;
  51. _paintList(list: Displayable[], scope: BrushScope, out?: SVGVNode[]): void;
  52. resize(width: number, height: number): void;
  53. getWidth(): number;
  54. getHeight(): number;
  55. dispose(): void;
  56. clear(): void;
  57. toDataURL(base64?: boolean): string;
  58. refreshHover: () => void;
  59. configLayer: (zlevel: number, config: import("../core/types").Dictionary<any>) => void;
  60. }
  61. export default SVGPainter;