     fileprivate let blendMode: CGBlendMode
     fileprivate let alpha: CGFloat
 
+    fileprivate let tint: UIColor?
+
     /**
      Initializes a DrawImage
      

        self.contentMode = contentMode
        self.blendMode = blendMode
        self.alpha = alpha
        super.init()
    }


        self.init(image: image, contentMode: contentMode, blendMode: .normal, alpha: 1)
    }

    /**
     Initializase a DrawImage, treating it as a 'template' image, applying the given template color

     - parameter image: The image to use as a template
     - parameter tint: The tint color to render with
     - parameter contentMode: The content mode to respect when performing the draw operation. Behavior is undefined if passed `.Redraw`
     */
    public init(image: UIImage, tint: UIColor, contentMode: UIViewContentMode) {
        self.image = image
        self.contentMode = contentMode
        self.blendMode = .normal
        self.alpha = 1
        self.tint = tint
        super.init()
    }

    override func performActionInContext(_ context: DrawContext) {
        var rect = context.rect
        rect = rectForSize(image.size, inRect: rect, contentMode: contentMode)
        
        UIGraphicsPushContext(context.graphicsContext)

        if let tint = tint {
            // Render as a template image
            context.performGraphicsActions { ctx in
                tint.setFill()
                // Flip the context since we're using CG apis
                ctx.translateBy(x: 0, y: rect.maxY)
                ctx.scaleBy(x: 1, y: -1)

                rect.origin.y = 0.0
                ctx.clip(to: rect, mask: image.cgImage!)
                ctx.fill(rect)
            }
        } else {
            image.draw(in: rect, blendMode: blendMode, alpha: alpha)
        }

        UIGraphicsPopContext()
        next?.performActionInContext(context)
    }
