init(case:pixel:palette:)

    Creates a transparency descriptor.

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

    Parameters

    case

    A transparency descriptor value.

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

    pixel

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

    Transparency descriptors are not allowed for grayscale-alpha or RGBA images, so setting pixel to one of those pixel formats will always result in a precondition failure.

    palette

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

    If case is a palette(alpha:) case, this palette must not be nil, and must contain at least as many entries as the number of alpha samples in the palette(alpha:) payload. Otherwise, this initializer will suffer a precondition failure.

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

    This initializer validates the transparency 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 transparency case. This is a separate type for validation purposes.

    Type members

    Instance members