/** * @see {@link https://blog.csdn.net/u598975767/article/details/106056002} */ import { Graph, IPoint, Point } from "./core"; declare interface ArcOptions { /** * radius-x 弧线所在椭圆的x轴半径 */ readonly rx: number; /** * radius-y 弧线所在椭圆的y轴半径 */ readonly ry: number; /** * radius-y xAxis-rotation 弧线所在椭圆的长轴角度 */ readonly xr: number; /** * large-arc-flag 是否选择弧长较长的那一段弧 默认0 */ readonly laf?: 0 | 1; /** * sweep-flag 是否选择逆时针方向的那一段弧 默认0 */ readonly sf?: 0 | 1; /** * 弧线终止点 起始点为当前光标所在的位置 如果没有默认坐标原点 */ readonly point: IPoint; } /** * path中的命令 大写表示绝对定位,小写表示相对定位 */ export default class Path extends Graph { items: Array; constructor(point?: Point); private static command; /** * 单个命令 * @param item 命令以及参数 */ push(item: string): this; /** * * @param point * @param relative 是否相对定位 */ moveto(point: IPoint, relative?: boolean): this; /** * 连线 从光标位置连线至 point * @param point * @param relative 是否相对定位 */ lineto(point: IPoint, relative?: boolean): this; /** * 水平移动 * @param length * @param relative 是否相对定位 */ horizontal(length: number, relative?: boolean): this; /** * 垂直移动 * @param length * @param relative 是否相对定位 */ vertical(length: number, relative?: boolean): this; /** * 圆弧 * @param options * @param relative 是否相对定位 */ arc(options: ArcOptions, relative?: boolean): this; /** * C x1 y1 x2 y2 x y * 三次贝塞尔曲线 * 当前点为起点,xy为终点,起点和x1y1控制曲线起始的斜率,终点和x2y2控制结束的斜率。 */ curveto(point1: IPoint, point2: IPoint, end: IPoint, relative?: boolean): this; /** * S x2 y2 x y * 简化的贝塞尔曲线 C的简化版 * 1.如果S命令跟在一个C命令或者另一个S命令的后面,它的第一个控制点,就会被假设成前一个控制点的对称点。 * 2.如果S命令单独使用,前面没有C命令或者另一个S命令,那么它的两个控制点就会被假设为同一个点。 */ smoothCurveto(point: IPoint, end: IPoint, relative?: boolean): this; /** * Q x1 y1 x y * 二次贝塞尔曲线Q * 只需要一个控制点,用来确定起点和终点的曲线斜率。因此它需要两组参数,控制点和终点坐标。 * @param point * @param end * @param relative 是否相对定位 */ quadratic(point: IPoint, end: IPoint, relative?: boolean): this; /** * @link https://www.cnblogs.com/fzz9/p/9249738.html?utm_source=debugrun&utm_medium=referral#%E3%80%80%E3%80%804%E5%85%89%E6%BB%91%E8%B4%9D%E5%A1%9E%E5%B0%94%E6%9B%B2%E7%BA%BF * Q命令的简写命令。
* 与S命令相似,T也会通过前一个控制点,推断出一个新的控制点。 * 1.T命令前面必须是一个Q命令,或者是另一个T命令 * 2.如果T单独使用,那么控制点就会被认为和终点是同一个点,所以画出来的将是一条直线 * @param point * @param end * @param relative 是否相对定位 */ smoothQuadratic(point: IPoint, end: IPoint, relative?: boolean): this; /** * 设置虚线 * @param dash * @param offset 偏移量 */ dash(dash: number | string, offset?: number): this; protected attrs(): any; } export {};