import { SColor, SGradientStop, SPoint } from "./"; /** * 渐变颜色节点 * * @author 庞利祥(sybotan@126.com) */ export abstract class SGradient { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // 属性定义 /** 起点 */ start = new SPoint(); /** 结束点 */ end = new SPoint(); /** 起点X坐标 */ get x1(): number { return this.start.x; } // Get x1 set x1(value: number) { this.start.x = value; } // Set x1 /** 起点Y坐标 */ get y1(): number { return this.start.y; } // Get y1 set y1(value: number) { this.start.y = value; } // Set y1 /** 终点X坐标 */ get x2(): number { return this.end.x; } // Get x2 set x2(value: number) { this.end.x = value; } // Set x2 /** 终点Y坐标 */ get y2(): number { return this.end.y; } // Get y2 set y2(value: number) { this.end.y = value; } // Set y2 /** 渐变颜色节点列表 */ stopList: SGradientStop[] = []; /** * 添加渐变颜色节点 * * @param pos 位置[0-1] * @param color 颜色 */ addColorStop(pos: number, color: SColor): void { this.stopList.push(new SGradientStop(pos, color)); } // Function addColorStop() /** * 设置起点坐标 * * @param x X坐标 * @param y Y坐标 */ setStart(x: number, y: number): void { this.start.x = x; this.start.y = y; } // Function setStart() /** * 设置终点坐标 * * @param x X坐标 * @param y Y坐标 */ setEnd(x: number, y: number): void { this.end.x = x; this.end.y = y; } // Function setEnd() } // Class SGradientStop