Static Methodswift-png 4.4.5PNG

    deconvolve(_:as:depth:kernel:)

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

    PNG.swift:1126
    static func deconvolve<A, T, C>(_ pixels: [C], as _: A.Type, depth: Int, kernel: (C) -> (T, T)) -> [UInt8] where A : FixedWidthInteger, A : UnsignedInteger, T : FixedWidthInteger, T : UnsignedInteger

    Parameters

    pixels

    A pixel array.

    _

    An atom type.

    depth

    A color depth specifying the range of the atom values. This depth can be no greater than A.bitWidth.

    kernel

    A pixel kernel.

    Returns

    An image data buffer. This array has a length of pixels.count, multiplied by twice the stride of A.

    This function maps the given kernel function over each element in pixels, receiving (T, T) intensity pairs in return. It then converts them into atoms of type A, scaling each intensity value to the range specified by the given color depth. The elements of the generated (A, A) pairs are then stored sequentially as big-endian integers in the returned image data buffer.

    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