UIImage

extension UIImage: FramePresentable
  • Declaration

    Swift

    public static func create(from renderTarget: OffscreenRenderTarget) -> `Self`?
  • Declaration

    Swift

    convenience init?(pixelBuffer: CVPixelBuffer)
  • This method doesn’t use copying data, since it can heavily affect performance and memory usage (for high quality photos like 3024x4032 each copy of data has size ~30 Mb, and on slower devices making copy can take up to 0.2 sec).

    Common idea - we have NSData object which contains raw data, used for UIImage creation. Since we don’t copy underlying data, we need to take control on lifetime of NSData object, otherwise internal content of UIImage will be destroyed. So, we manually transform NSData object into unmanaged pointer and increase its retain count by passRetained call, and in special callback of CGDataProvider, which will be called when UIImage is no longer needed, we release that unmanaged pointer by takeRetainedValue call, to prevent memory leaks.

    Declaration

    Swift

    convenience init?(
        bgraDataNoCopy: NSData,
        width: Int,
        height: Int
    )
  • Declaration

    Swift

    convenience init?(
        rgbaDataNoCopy: NSData,
        width: Int,
        height: Int
    )
  • Declaration

    Swift

    func makeBgraPixelBuffer() -> CVPixelBuffer?
  • Declaration

    Swift

    func fixedOrientationImage() -> UIImage
  • Declaration

    Swift

    func exportToPath(_ path: String, fixOrientation: Bool, completion: ((Bool) -> Void))