CGImage

extension CGImage
  • Converts the image into an array of RGBA bytes.

    Declaration

    Swift

    @nonobjc
    public func toByteArrayRGBA() -> [UInt8]
  • Creates a new CGImage from an array of RGBA bytes.

    Declaration

    Swift

    @nonobjc
    public class func fromByteArrayRGBA(_ bytes: [UInt8],
                                        width: Int,
                                        height: Int) -> CGImage?
  • Creates a new CGImage from an array of grayscale bytes.

    Declaration

    Swift

    @nonobjc
    public class func fromByteArrayGray(_ bytes: [UInt8],
                                        width: Int,
                                        height: Int) -> CGImage?