import { Graph, GraphOptions, IPoint, Point, ViewBox } from "./core"; export declare abstract class Def extends Graph { readonly id: string; protected constructor(id: string, element: SVGElement); } export default class Defs extends Graph { constructor(); def(def: Def): this; } export declare class PatternOptions extends GraphOptions { readonly id: string; readonly x: number; readonly y: number; readonly width: number; readonly height: number; constructor(id: string, x: number, y: number, width: number, height: number); } /** * 用于填充 */ export declare class Pattern extends Def { readonly options: PatternOptions; constructor(options: PatternOptions | { id: string; x: number; y: number; width: number; height: number; }, attrs?: any); protected attrs(): any; } export declare class Gradient extends Def { protected readonly stops: GradientStop[]; constructor(id: string, element: SVGElement); stop(stop: GradientStop): this; } export declare class LinearGradientOptions extends GraphOptions { /** * 渐变起始点 x值 */ readonly x1: number | string; /** * 渐变起始点 y值 */ readonly x2: number | string; /** * 渐变截止点 x值 */ readonly y1: number | string; /** * 渐变截止点 y值 */ readonly y2: number | string; constructor(x1: number | string, x2: number | string, y1: number | string, y2: number | string); } /** * 线性渐变 可用来定义 SVG 的线性渐变,主要是定义方向和颜色。 * 标签一般嵌套在 的内部。 * (SVG的元素用于预定义(不会显示)一个元素使其能够在SVG图像中重复使用。) * 渐变方向 * |方向|参数| * |--|--| * |水平|当 y1 和 y2 相等,而 x1 和 x2 不同时| * |垂直|当 x1 和 x2 相等,而 y1 和 y2 不同时| * |角形|当 x1 和 x2 不同,且 y1 和 y2 不同时| */ export declare class LinearGradient extends Gradient { readonly stops: GradientStop[]; readonly options: LinearGradientOptions; /** * @param id id * @param options.start 渐变起始点 * @param options.end 渐变截止点 * @param options 配置项 * @param attrs */ constructor(id: string, options: LinearGradientOptions | { start: IPoint; end: IPoint; }, attrs?: any); protected attrs(): any; } export interface GradientStop { offset: string; stopColor: string; } /** */ export declare class RadialGradientOptions extends GraphOptions { /** * 渐变的中心点x位置 */ readonly cx: number | string; /** * 渐变的中心点y位置 */ readonly cy: number | string; /** * 渐变的半径 */ readonly r: number | string; /** * 渐变的焦点x位置 */ readonly fx: number | string; /** * 渐变的焦点y位置 */ readonly fy: number | string; constructor(cx: number | string, cy: number | string, r: number | string, fx: number | string, fy: number | string); } /** * 径向渐变 可用来定义 SVG 的径向渐变,主要是定义方向和颜色。 * 可用来定义 SVG 的径向渐变,主要是定义方向和颜色。 渐变方向 cx、cy 和 r 属性定义外圈,而 fx和fy 定义内圈(可认为是往哪聚焦) 。 |名称| 描述 |默认值| |---|---|---| |cx| 渐变的中心点x位置| 50%| |cy| 渐变的中心点y位置| 50%| |r| 渐变的半径| 50%| |fx| 渐变的焦点| 0%| |fy| 渐变的焦点| 0%| */ export declare class RadialGradient extends Gradient { readonly stops: GradientStop[]; readonly options: RadialGradientOptions; /** * @param id 被引用的id * @param options.o 渐变的中心点坐标 * @param options.r 渐变的半径 数字或者百分比 * @param options.focus 渐变的焦点坐标 * @param options 配置属性 * @param attrs */ constructor(id: string, options: RadialGradientOptions | { o: IPoint; r: number | string; focus: IPoint; }, attrs?: any); protected attrs(): any; } /** * */ export declare class UseOptions extends GraphOptions { readonly xlink_href: string; /**参考 * @see Mask */ readonly mask?: string; readonly point?: Point; readonly width?: number; readonly height?: number; constructor(xlink_href: string, options?: { point?: IPoint; width?: number; height?: number; mask?: string; }); getAttrs(): { 'xlink:href': string; x: number | undefined; y: number | undefined; width: number | undefined; height: number | undefined; mask: string | undefined; }; } export declare class Use extends Graph { options: UseOptions; constructor(options: UseOptions, attrs?: any); static link(id: string, options?: { point?: IPoint; width?: number; height?: number; mask?: string; }): Use; mask(mask: string): this; protected attrs(): any; } export declare class SymbolOptions extends GraphOptions { readonly id: string; readonly viewBox?: ViewBox | string; readonly width?: string; readonly height?: string; constructor(id: string, options?: { viewBox?: ViewBox | string; width?: string; height?: string; }); getAttrs(): { id: string; width: string | undefined; height: string | undefined; }; } export declare class Symbol extends Graph { readonly options: SymbolOptions; constructor(options: SymbolOptions, attrs?: any); use(options?: { point?: IPoint; width?: number; height?: number; }): Use; } export declare class ClipPathOptions extends GraphOptions { clipPath?: string; clipPathUnits: 'userSpaceOnUse' | 'objectBoundingBox'; constructor(clipPath: string, clipPathUnits?: "userSpaceOnUse" | "objectBoundingBox"); } /** * 用于隐藏位于剪切路径以外的对象部分。定义绘制什么和什么不绘制的模具被称为剪切路径 * @example * * * * * * * */ export declare class ClipPath extends Def { constructor(id: string); } declare interface IMarkerOptions { viewBox?: ViewBox; markerWidth?: number; markerHeight?: number; orient?: 'auto' | number; refX?: number; refY?: number; markerUnits?: 'strokeWidth' | 'userSpaceOnUse'; } /** * markerUnits="strokeWidth'或'userSpaceOnUse"。如果是strokeWidth"那么使用一个单位等于一个笔划宽度。否则,标记尺度不会使用同一视图单位作为引用元素(默认为'strokeWidth')" * refx="标记顶点连接的位置(默认为0)" * refy="标记顶点连接的位置(默认为0)" * orient="'auto'始终显示标记的角度。 "auto"将计算某个角度使得X轴一个顶点的正切值(默认为0) * markerWidth="标记的宽度(默认3)" * markerHeight="标记的高度(默认3)" * viewBox="各点"看到"这个SVG绘图区域。由空格或逗号分隔的4个值。(min x, min y, width, height)" */ export declare class MarkerOptions extends GraphOptions { id: string; viewBox?: ViewBox; markerWidth?: number; markerHeight?: number; orient?: 'auto' | number; refX?: number; refY?: number; markerUnits?: 'strokeWidth' | 'userSpaceOnUse'; constructor(id: string, options?: IMarkerOptions); } /** * * 标记可以放在直线,折线,多边形和路径的顶点。 * 这些元素可以使用marker属性的"marker-start","marker-mid"和"marker-end",继承默认情况下或可设置为"none"或定义的标记的URI。 * 必须先定义标记,然后才可以通过其URI引用。任何一种形状,可以把标记放在里面。他们绘制元素时把它们附加到顶部 * * * * * * * */ export declare class Marker extends Def { readonly options: MarkerOptions; constructor(options: MarkerOptions); protected attrs(): any; draw(): SVGElement; static build(id: string, options?: IMarkerOptions): Marker; } declare interface IMaskOptions { maskUnits: "userSpaceOnUse" | "objectBoundingBox"; maskContentUnits: "userSpaceOnUse" | "objectBoundingBox"; x: number | string; y: number | string; width: number | string; height: number | string; } export declare class MaskOptions extends GraphOptions { id: string; maskUnits?: 'userSpaceOnUse' | 'objectBoundingBox'; maskContentUnits?: 'userSpaceOnUse' | 'objectBoundingBox'; x?: number | string; y?: number | string; width?: number | string; height?: number | string; constructor(id: string, options?: IMaskOptions); } /** * 度屏蔽是一种不透明度值的组合和裁剪。像裁剪,您可以使用图形,文字或路径定义掩码的部分。 * 一个掩码的默认状态是完全透明的,也就是裁剪平面的对面的。 * 在掩码的图形设置掩码的不透明部分 * maskUnits="'userSpaceOnUse' or 'objectBoundingBox'.设定裁剪面是否是相对完整的视窗或对象(默认:'objectBoundingBox')" * maskContentUnits="第二个掩码相对对象的图形位置使用百分比'userSpaceOnUse'或'objectBoundingBox'(默认:'userSpaceOnUse')" * x="裁剪面掩码(默认值:-10%)" * y="裁剪面掩码(默认值:-10%)" * width="裁剪面掩码(默认是:120%)" * height="裁剪面掩码(默认是:120%)" */ export declare class Mask extends Def { readonly options: MaskOptions; constructor(options: MaskOptions); } export {};