| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- import { SColor, SLineCapStyle, SLineJoinStyle } from "./";
- /**
- * 画笔
- *
- * @author 庞利祥(sybotan@126.com)
- */
- export class SPen {
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- // 属性定义
- /** 画笔颜色 */
- color = SColor.Black;
- /** 线宽 */
- lineWidth = 1;
- /** 线段端点样式 */
- lineCapStyle = SLineCapStyle.Butt;
- /** 线段与线段间接合处的样式 */
- lineJoinStyle = SLineJoinStyle.Miter;
- /** 限制当两条线相交时交接处最大长度 (默认值是10.0)*/
- miterLimit = 10;
- /** 虚线样式 */
- lineDash: number[] | null = null;
- /** 虚线样式的起始偏移量 */
- dashOffset = 0;
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- // 构造函数
- /**
- * 构造函数
- */
- constructor();
- /**
- * 构造函数
- *
- * @param pen 画笔
- */
- constructor(pen: SPen);
- /**
- * 构造函数
- *
- * @param color 颜色
- * @param lineWidth 线宽
- */
- constructor(color: SColor, lineWidth?: number);
- /**
- * 构造函数
- *
- * @param color 颜色 | 画笔
- * @param lineWidth 线宽
- */
- constructor(color?: SColor | SPen, lineWidth?: number) {
- if (color == undefined) {
- return;
- }
- if (color instanceof SPen) {
- this.color = new SColor(color.color);
- this.lineWidth = color.lineWidth;
- this.lineCapStyle = color.lineCapStyle;
- this.lineJoinStyle = color.lineJoinStyle;
- this.miterLimit = color.miterLimit;
- this.dashOffset = color.dashOffset;
- this.lineDash =
- color.lineDash != null ? color.lineDash.slice() : null;
- } else {
- this.color = new SColor(color);
- this.lineWidth = lineWidth != undefined ? lineWidth : 1;
- }
- } // Constructor()
- } // Class SPen
|