Contents

init(name:withInputParameters:)

Creates a Cifilter Swift.class object for a specific kind of filter and initializes the input values.

Declaration

init?(name: String, withInputParameters params: [String : Any]?)

Parameters

  • name:

    The name of the filter. You must make sure the name is spelled correctly, otherwise your app will run but not produce any output images. For that reason, you should check for the existence of the filter after calling this method.

  • params:

    A list of key-value pairs to set as input values to the filter. Each key is a constant that specifies the name of an input parameter for the filter, and the corresponding value is the value for that parameter. See TP40004346 for built-in filters and their allowed parameters.

Return Value

A CIFilter object whose input values are initialized.

Discussion

Use this method to quickly create and configure a CIFilter instance, as in the example below.

CIFilter *f = [CIFilter filterWithName: @"CIColorControls"
                   withInputParameters: @{
                             @"inputImage"      : inImage,
                             @"inputSaturation" : @0.5,
                             @"inputBrightness" : @1.2,
                             @"inputContrast"   : @1.3
                                         }];

See Also

Creating a filter