             alphaInfo = .premultipliedFirst
         }
 
-        switch alphaInfo {
-        case .none:               hasAlpha = false
-        case .first:              hasAlpha = true
-        case .last:               hasAlpha = true
-        case .noneSkipFirst:      hasAlpha = false
-        case .noneSkipLast:       hasAlpha = false
-        case .alphaOnly:          hasAlpha = true
-        case .premultipliedFirst: hasAlpha = true
-        case .premultipliedLast:  hasAlpha = true
-        }
+        hasAlpha = alphaState(alphaInfo: alphaInfo)
 
         let colorSpace = CGColorSpaceCreateDeviceRGB()
         let rowBytes = width * bytesPerPixel

        }
    }

    func image(mipLevel: Int) -> UIImage {
        let p = bytesForMipLevel(mipLevel: mipLevel)
        let q = Int(powf(2, Float(mipLevel)))
        let mipmapedWidth = max(width / q, 1)

            bitmapInfo: CGImageAlphaInfo.premultipliedLast.rawValue
        )
        return UIImage(cgImage: (context?.makeImage())!)
    }

    func bytes() -> UnsafeMutableRawPointer {
