diff options
Diffstat (limited to 'Captura/Core Extensions/CVImageBuffer+cgImage.swift')
| -rw-r--r-- | Captura/Core Extensions/CVImageBuffer+cgImage.swift | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Captura/Core Extensions/CVImageBuffer+cgImage.swift b/Captura/Core Extensions/CVImageBuffer+cgImage.swift new file mode 100644 index 0000000..c30cb0c --- /dev/null +++ b/Captura/Core Extensions/CVImageBuffer+cgImage.swift @@ -0,0 +1,11 @@ +import Foundation +import ReplayKit + +extension CVImageBuffer { + + var cgImage: CGImage? { + let ciImage = CIImage(cvImageBuffer: self) + let context = CIContext() + return context.createCGImage(ciImage, from: CGRect(x: 0, y: 0, width: CVPixelBufferGetWidth(self), height: CVPixelBufferGetHeight(self))) + } +} |