 
 class ViewController: UIViewController {
     @IBOutlet var viewMain:UIView!
+    let image = UIImage(named: "dog.jpg")!
     var layers = [CALayer]()
     var xform = CGAffineTransformIdentity
 
     var builder = SNPathBuilder(minSegment: 8.0)
     lazy var shapeLayer:CAShapeLayer = {
         let layer = self.createShapeLayer()
-        layer.opacity = 0.8
+        layer.opacity = 0.5
         self.viewMain.layer.addSublayer(layer)
         return layer
     }()
+    lazy var imageView:UIImageView = {
+        let view = UIImageView(frame: self.viewMain.bounds)
+        view.image = self.image
+        view.contentMode = .ScaleAspectFit
+        return view
+    }()
     lazy var maskView:UIImageView = {
-        let maskView = UIImageView(frame: self.viewMain.bounds)
-        maskView.contentMode = .ScaleAspectFit
-        return maskView
+        let view = UIImageView(frame: self.viewMain.bounds)
+        view.contentMode = .ScaleAspectFit
+        return view
     }()
     
     private func createShapeLayer() -> CAShapeLayer {

            shapeLayer.path = nil
            let layer = createShapeLayer()
            layer.path = builder.end()
            self.viewMain.layer.insertSublayer(layer, below: shapeLayer)
            layers.append(layer)
        default:
            shapeLayer.path = nil
        }

        layer.lineWidth = 10
        layer.fillColor = UIColor.clearColor().CGColor
        layer.strokeColor = UIColor(red: 1, green: 0, blue: 1, alpha: 1).CGColor
        layer.shadowRadius = 2.0
        layer.shadowColor = layer.strokeColor
        layer.shadowOpacity = 1.0
        layer.shadowOffset = CGSize.zero
        layer.lineCap = "round"
        layer.lineJoin = "round"
        return layer
