Instance Methodswift-png 4.4.5PNG

    premultiplied(as:)

    The color obtained by premultiplying the red, green, and blue components of this color with its alpha channel, performing the premultiplication in the given integer type.

    PNG.RGBA.swift:146
    func premultiplied<U>(as _: U.Type) -> PNG.RGBA<T> where U : FixedWidthInteger, U : UnsignedInteger

    Parameters

    _

    The integer type to perform the premultiplications in. U.bitWidth must be less than T.bitWidth.

    Returns

    The premultiplied color.

    Premultiplication in a different integer type is sometimes necessary to reproduce the output of other image processing frameworks.

    The premultiplied color is obtained by invoking premultiply(_:alpha:) on r, g, and b, after scaling them to the range of U. The returned components are then scaled back to the range of T. The rescaling operation also affects the a component.

    Other members in extension

    Typealiases

    Type members

    Instance members

    • var premultiplied: `Self`

      The color obtained by premultiplying the red, green, and blue components of this color with its alpha channel.

    • var straightened: `Self`

      The color obtained by straightening the red, green, and blue components of this color according to its alpha channel.

    • var va: PNG.VA<T>

      The grayscale-alpha color obtained by discarding the green and blue components of this color.

    • func straightened<U>(as: U.Type) -> PNG.RGBA<T>

      The color obtained by straightening the red, green, and blue components of this color according to its alpha channel, performing the straightening in the given integer type.