Mac Developer Library

Developer

QuartzCore Framework Reference CIFilterConstructor Protocol Reference

Options
Deployment Target:

On This Page
Language:

CIFilterConstructor

Inheritance


Not Applicable

Conforms To


Not Applicable

Import Statement


Swift

import QuartzCore

Objective-C

@import QuartzCore;

Availability


Available in OS X v10.7 and later.

The CIFilterConstructor protocol defines a method for supplying CIFilter objects.

Objects implementing this protocol are called filter constructors—they produce new instances of CIFilter subclasses when filters are requested by name. You can create a filter constructor to provide new, custom filters that other Core Image clients can discover using the CIFilter class. Normally, you create and register custom filters by packaging them as Image Units (see Packaging and Loading Image Units), but you can use this protocol to provide new filters within your app that are compositions of existing filters.

To provide custom filters using this protocol, you must:

  1. Create your custom filters as CIFilter subclasses.

  2. Create a class that implements this protocol to vend instances of the appropriate CIFilter subclasses when requested.

  3. Call the CIFilter class method registerFilterName:constructor:classAttributes: for each custom filter, providing the filter’s name, an instance of your filter constructor class, and information about the filter’s attributes.

  • Returns a filter object specified by name. (required)

    Declaration

    Swift

    func filterWithName(_ name: String!) -> CIFilter!

    Objective-C

    - (CIFilter *)filterWithName:(NSString *)name

    Parameters

    name

    The name of the requested custom filter.

    Return Value

    A CIFilter object implementing the custom filter.

    Discussion

    Core Image calls this method when a filter is requested by name using the CIFilter class method filterWithName: method (or related methods). Your implementation of this method should provide a new instance of the CIFilter subclass for your custom filter.

    Import Statement

    Objective-C

    @import QuartzCore;

    Swift

    import QuartzCore

    Availability

    Available in OS X v10.7 and later.