Contents

applyGamma(_:destination:)

Applies a gamma function to a 32-bit pixel buffer.

Declaration

func applyGamma(_ gamma: vImage.Gamma, destination: vImage.PixelBuffer<Format>)

Parameters

  • gamma:

    An enumeration that specifies either a used-defined or constant gamma.

  • destination:

    The destination pixel buffer.

Discussion

For example, the following code applies a gamma of `2.0` to a one-pixel pixel buffer:

let buffer = vImage.PixelBuffer<vImage.PlanarF>(
    pixelValues: [0.5],
    size: vImage.Size(width: 1,
                      height: 1))

buffer.applyGamma(.fullPrecision(2),
                  destination: buffer)

// Prints "[0.25]" = [0.5²].
print(buffer.array)

See Also

Applying gamma