     
     var image:UIImage!
     var delegate:SNTrimControllerDelegate!
+    
+    // Metal
+    static let device = MTLCreateSystemDefaultDevice()
+    let function = SNTrimController.device?.newDefaultLibrary()?.newFunctionWithName("maskImage")
 
     private let borderView:UIView = {
         let borderView = UIView()

//
extension SNTrimController: SNTrimColorPickerDelegate {
    func updateMaskColor(color:UIColor?, fPlus:Bool) {
        guard let device = MTLCreateSystemDefaultDevice() else {
            print("SNTrim No Metal. User CPU")
            return updateMaskColorCPU(color, fPlus: fPlus)
        }

            encoder.setBytes(&uz0, length: sizeofValue(uz0), atIndex: 5)
            encoder.setBytes(&inv, length: sizeofValue(inv), atIndex: 6)

            let pipeline = try! device.newComputePipelineStateWithFunction(function)
            encoder.setComputePipelineState(pipeline)
            let threadExeWidth = pipeline.threadExecutionWidth
