Painter.d.ts 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. }): SVGVNode;
  43. renderToString(opts?: {
  44. cssAnimation?: boolean;
  45. useViewBox?: boolean;
  46. }): string;
  47. setBackgroundColor(backgroundColor: SVGPainterBackgroundColor): void;
  48. getSvgRoot(): SVGElement;
  49. _paintList(list: Displayable[], scope: BrushScope, out?: SVGVNode[]): void;
  50. resize(width: number, height: number): void;
  51. getWidth(): number;
  52. getHeight(): number;
  53. dispose(): void;
  54. clear(): void;
  55. toDataURL(base64?: boolean): string;
  56. refreshHover: () => void;
  57. configLayer: (zlevel: number, config: import("../core/types").Dictionary<any>) => void;
  58. }
  59. export default SVGPainter;