Static Methodswift-png 4.4.5PNG

    convolve(_:of:depth:kernel:)

    Converts an image data buffer to a pixel array, using the given pixel kernel.

    PNG.swift:664
    static func convolve<A, T, C>(_ buffer: [UInt8], of _: A.Type, depth: Int, kernel: ((T, T, T, T)) -> C) -> [C] where A : FixedWidthInteger, A : UnsignedInteger, T : FixedWidthInteger, T : UnsignedInteger

    Parameters

    buffer

    An image data buffer. Its length must be divisible by four times the stride of A.

    _

    An atom type.

    depth

    A color depth used to interpret the intensity of each atom. This depth must be no greater than A.bitWidth.

    kernel

    A pixel kernel.

    Returns

    An array of pixels constructed by the given kernel function. This array has a length of buffer.count divided by the four times the stride of A.

    This function interprets buffer as an array of big-endian atoms of type A. It then scales the atoms to the range of T, according to the given color depth, and constructs instances of C by mapping the given kernel function over consecutive (T, T, T, T) quadruplets.

    A worked example of how to use this function to implement a custom color target can be found in the custom color targets tutorial.

    Other members in extension

    Protocols

    Types

    Show obsolete interfaces (2)

    Hide obsolete interfaces

    Type members