]> git.r.bdr.sh - rbdr/captura/blob - Captura/Core Extensions/CVImageBuffer+cgImage.swift
c30cb0c9433f4858e78d919fed16f8d0ed3d74d1
[rbdr/captura] / Captura / Core Extensions / CVImageBuffer+cgImage.swift
1 import Foundation
2 import ReplayKit
3
4 extension CVImageBuffer {
5
6 var cgImage: CGImage? {
7 let ciImage = CIImage(cvImageBuffer: self)
8 let context = CIContext()
9 return context.createCGImage(ciImage, from: CGRect(x: 0, y: 0, width: CVPixelBufferGetWidth(self), height: CVPixelBufferGetHeight(self)))
10 }
11 }