|
@@ -1,4 +1,4 @@
|
|
-import { SColor, SGradientStop } from "./";
|
|
|
|
|
|
+import { SColor, SGradientStop, SPoint } from "./";
|
|
|
|
|
|
/**
|
|
/**
|
|
* 渐变颜色节点
|
|
* 渐变颜色节点
|
|
@@ -6,6 +6,46 @@ import { SColor, SGradientStop } from "./";
|
|
* @author 庞利祥(sybotan@126.com)
|
|
* @author 庞利祥(sybotan@126.com)
|
|
*/
|
|
*/
|
|
export abstract class SGradient {
|
|
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[] = [];
|
|
stopList: SGradientStop[] = [];
|
|
|
|
|
|
@@ -18,4 +58,26 @@ export abstract class SGradient {
|
|
addColorStop(pos: number, color: SColor): void {
|
|
addColorStop(pos: number, color: SColor): void {
|
|
this.stopList.push(new SGradientStop(pos, color));
|
|
this.stopList.push(new SGradientStop(pos, color));
|
|
} // Function addColorStop()
|
|
} // 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
|
|
} // Class SGradientStop
|