OSDN Git Service

Equatableを自動実装させるようにした
[kcd/KCD.git] / KCD / NSTextFieldExtension.swift
index 27e3d74..dc620d8 100644 (file)
@@ -12,14 +12,12 @@ extension NSTextField {
     
     func maskImage(middle1: CGFloat, middle2: CGFloat) -> CGImage {
         
-        let colorspace = CGColorSpaceCreateDeviceGray()
-        
         guard let maskContext = CGContext(data: nil,
                                           width: Int(bounds.width),
                                           height: Int(bounds.height),
                                           bitsPerComponent: 8,
                                           bytesPerRow: Int(bounds.width),
-                                          space: colorspace,
+                                          space: CGColorSpaceCreateDeviceGray(),
                                           bitmapInfo: 0) else {
                                             
                                             fatalError("Can not create bitmap context")
@@ -38,7 +36,10 @@ extension NSTextField {
                                   (.black, 1.0))
         gradient?.draw(in: bounds, angle: 0.0)
         
-        guard let r = maskContext.makeImage() else { fatalError(" can not create image from context") }
+        guard let r = maskContext.makeImage() else {
+            
+            fatalError(" can not create image from context")
+        }
         
         return r
     }
@@ -47,7 +48,7 @@ extension NSTextField {
         
         guard let currentFont = font else {
             
-            Swift.print("TextField dose not set font")
+            Logger.shared.log("TextField dose not set font")
             
             return false
         }