ColorMatrix

public struct ColorMatrix : ColorMatrixProtocol

This struct provides tools to create and manipulate color matrices. These can be passed into a CIKernel.

Properties

  • This array contains the data of the matrix.

    Declaration

    Swift

    public private(set) var data: [CGFloat]

Initializers

  • Creates a new identity matrix.

    Declaration

    Swift

    public init()
  • Creates a new matrix containing the given data.

    Declaration

    Swift

    public init(data: [CGFloat])

    Parameters

    data

    The data to initialize the color matrix with.

  • Creates a new exposure matrix.

    Declaration

    Swift

    public init(exposure: CGFloat)

    Parameters

    exposure

    The desired exposure. This value ranges from -1 to 1.

  • Creates a new contrast matrix.

    Declaration

    Swift

    public init(contrast: CGFloat)

    Parameters

    contrast

    The desired contrast. This value ranges from -1 to 1.

  • Creates a new saturation matrix.

    Declaration

    Swift

    public init(saturation: CGFloat)

    Parameters

    saturation

    The desired saturation. This value ranges from -1 to 1.

  • Creates a new brightness matrix.

    Declaration

    Swift

    public init(brightness: CGFloat)

    Parameters

    brightness

    The desired brightness. This value ranges from -1 to 1.

Manipulation

  • Combines the color matrix with another color matrix.

    Declaration

    Swift

    public mutating func concatenate(_ matrix: ColorMatrix)

    Parameters

    matrix

    The color matrix to concatenate to this matrix.

  • Combines the color matrix with another color matrix and returns the new matrix.

    Declaration

    Swift

    public func concatenating(_ matrix: ColorMatrix) -> ColorMatrix

    Parameters

    matrix

    The color matrix to concatenate to this matrix.

    Return Value

    The new matrix.