SLinearGradient.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import { SGradient, SPoint } from "./";
  2. /**
  3. * 线性渐变
  4. *
  5. * @author 庞利祥(sybotan@126.com)
  6. */
  7. export class SLinearGradient extends SGradient {
  8. /**
  9. * 构造函数
  10. *
  11. * @param start 起点坐标
  12. * @param end 终点坐标
  13. */
  14. constructor(start: SPoint, end: SPoint);
  15. /**
  16. * 构造函数
  17. *
  18. * @param x1 起点X坐标
  19. * @param y1 起点Y坐标
  20. * @param x2 终点X坐标
  21. * @param y2 终点Y坐标
  22. */
  23. constructor(x1: number, y1: number, x2: number, y2: number);
  24. /**
  25. * 构造函数(重载实现)
  26. *
  27. * @param x1 起点X坐标
  28. * @param y1 起点Y坐标
  29. * @param x2 终点X坐标
  30. * @param y2 终点Y坐标
  31. */
  32. constructor(
  33. x1: number | SPoint,
  34. y1: number | SPoint,
  35. x2?: number,
  36. y2?: number
  37. ) {
  38. super();
  39. if (x1 instanceof SPoint && y1 instanceof SPoint) {
  40. this.start = new SPoint(x1);
  41. this.end = new SPoint(y1);
  42. } else {
  43. this.start = new SPoint(x1 as number, y1 as number);
  44. this.end = new SPoint(x2 as number, y2 as number);
  45. }
  46. } // Constructor()
  47. } // Class SGradientBrush