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