swhitty / SwiftDraw

@@ -37,13 +37,15 @@
Loading
37 37
38 38
        var stops: [Stop]
39 39
        var gradientUnits: Units?
40 +
        var gradientTransform: [Transform]
40 41
41 42
        //references another RadialGradient element id within defs
42 43
        var href: URL?
43 -
44 +
        
44 45
        init(id: String) {
45 46
            self.id = id
46 47
            self.stops = []
48 +
            self.gradientTransform = []
47 49
        }
48 50
49 51
        struct Stop: Equatable {

@@ -31,55 +31,57 @@
Loading
31 31
32 32
extension DOM {
33 33
34 -
  final class LinearGradient: Element {
34 +
    final class LinearGradient: Element {
35 35
36 -
    var id: String
37 -
    var x1: Coordinate?
38 -
    var y1: Coordinate?
39 -
    var x2: Coordinate?
40 -
    var y2: Coordinate?
36 +
        var id: String
37 +
        var x1: Coordinate?
38 +
        var y1: Coordinate?
39 +
        var x2: Coordinate?
40 +
        var y2: Coordinate?
41 41
42 -
    var stops: [Stop]
43 -
    var gradientUnits: Units?
42 +
        var stops: [Stop]
43 +
        var gradientUnits: Units?
44 +
        var gradientTransform: [Transform]
44 45
45 -
    //references another LinearGradient element id within defs
46 -
    var href: URL?
46 +
        //references another LinearGradient element id within defs
47 +
        var href: URL?
47 48
48 -
    init(id: String) {
49 -
      self.id = id
50 -
      self.stops = []
51 -
    }
49 +
        init(id: String) {
50 +
            self.id = id
51 +
            self.stops = []
52 +
            self.gradientTransform = []
53 +
        }
52 54
53 -
    struct Stop: Equatable {
54 -
      var offset: Float
55 -
      var color: Color
56 -
      var opacity: Float
55 +
        struct Stop: Equatable {
56 +
            var offset: Float
57 +
            var color: Color
58 +
            var opacity: Float
57 59
58 -
      init(offset: Float, color: Color, opacity: Opacity = 1.0) {
59 -
        self.offset = offset
60 -
        self.color = color
61 -
        self.opacity = opacity
62 -
      }
60 +
            init(offset: Float, color: Color, opacity: Opacity = 1.0) {
61 +
                self.offset = offset
62 +
                self.color = color
63 +
                self.opacity = opacity
64 +
            }
65 +
        }
63 66
    }
64 -
  }
65 67
}
66 68
67 69
extension DOM.LinearGradient: Equatable {
68 -
  static func ==(lhs: DOM.LinearGradient, rhs: DOM.LinearGradient) -> Bool {
69 -
    return
70 -
      lhs.id == rhs.id &&
70 +
    static func ==(lhs: DOM.LinearGradient, rhs: DOM.LinearGradient) -> Bool {
71 +
        return
72 +
        lhs.id == rhs.id &&
71 73
        lhs.x1 == rhs.x1 &&
72 74
        lhs.y1 == rhs.y1 &&
73 75
        lhs.x2 == rhs.x2 &&
74 76
        lhs.y2 == rhs.y2 &&
75 77
        lhs.stops == rhs.stops
76 -
  }
78 +
    }
77 79
}
78 80
79 81
extension DOM.LinearGradient {
80 82
81 -
  enum Units: String {
82 -
    case userSpaceOnUse
83 -
    case objectBoundingBox
84 -
  }
83 +
    enum Units: String {
84 +
        case userSpaceOnUse
85 +
        case objectBoundingBox
86 +
    }
85 87
}

@@ -64,6 +64,10 @@
Loading
64 64
        node.gradientUnits = try nodeAtt.parseRaw("gradientUnits")
65 65
        node.href  = try? nodeAtt.parseUrl("xlink:href")
66 66
67 +
        if let val = try? nodeAtt.parseString("gradientTransform") {
68 +
          node.gradientTransform = try parseTransform(val)
69 +
        }
70 +
67 71
        return node
68 72
    }
69 73

@@ -60,6 +60,10 @@
Loading
60 60
        node.gradientUnits = try nodeAtt.parseRaw("gradientUnits")
61 61
        node.href  = try? nodeAtt.parseUrl("xlink:href")
62 62
63 +
        if let val = try? nodeAtt.parseString("gradientTransform") {
64 +
          node.gradientTransform = try parseTransform(val)
65 +
        }
66 +
63 67
        return node
64 68
    }
65 69
Files Coverage
SwiftDraw 75.76%
Project Totals (64 files) 75.76%
1
ignore:
2
  - "SwiftDrawTests"
3
  - "CommandLine"
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading