init(case:pixel:palette:)

    Creates a background descriptor.

    PNG.Background.swift:53
    init(case: Case, pixel: PNG.Format.Pixel, palette: PNG.Palette?)

    Parameters

    case

    A background descriptor value.

    If this parameter is a v(_:) or rgb(_:) case, the samples in its background color payload must fall within the range determined by the image color depth. Passing an enumeration case with an invalid background sample will result in a precondition failure.

    pixel

    The pixel format of the image this background descriptor is to be used for. Passing a mismatched enumeration case will result in a precondition failure.

    palette

    The palette of the image this background descriptor is to be used for.

    If case is a palette(index:) case, this palette must not be nil, and the number of entries in it must be at least 1 greater than the value of the palette(index:) payload. If the index payload is out of range, this function will suffer a precondition failure.

    If case is a v(_:) or rgb(_:) case, this parameter is ignored.

    This initializer validates the background information against the given pixel format and image palette. Some pixel formats imply that palette must be nil. This initializer does not check this assumption, as it is expected to have been verified by Palette.init(entries:pixel:).

    Other members in extension

    Types

    • enum Case

      A background case. This is a separate type for validation purposes.

    Type members

    Instance members