... | ... | @@ -4,7 +4,7 @@ |
|
|
|
|
|
### Tracking down errors
|
|
|
|
|
|
When something goes wrong with the interpretation of the json or plist data when creating or rendering a image filter chain object then smig will often return a terse error message. When this happens it is likely that there will be useful information in MovingImages' log file. The [Introduction to using MovingImages debugging section describes how to view the log file](UsingMovingImages#debugging).
|
|
|
When something goes wrong with the interpretation of the json or plist data when creating or rendering a image filter chain object then smig will often return a terse error message. When this happens it is likely that there will be useful information in the MovingImages' log file. The [Introduction to using MovingImages debugging section describes how to view the log file](UsingMovingImages#debugging).
|
|
|
|
|
|
### Getting a list of the CoreImage filters
|
|
|
|
... | ... | @@ -18,22 +18,22 @@ To get the list of filters that belong to particular category: |
|
|
|
|
|
All the filters belong to more than one category. The list of categories, from Apple's documentation are:
|
|
|
|
|
|
CICategoryBlur
|
|
|
CICategoryColorAdjustment
|
|
|
CICategoryCompositeOperation
|
|
|
CICategoryDistortionEffect
|
|
|
CICategoryGenerator
|
|
|
CICategoryGeometryAdjustment
|
|
|
CICategoryGradient
|
|
|
CICategoryHalftoneEffect
|
|
|
CICategorySharpen
|
|
|
CICategoryStylyize
|
|
|
CICategoryTileEffect
|
|
|
CICategoryTransition
|
|
|
CICategoryBlur
|
|
|
CICategoryColorAdjustment
|
|
|
CICategoryCompositeOperation
|
|
|
CICategoryDistortionEffect
|
|
|
CICategoryGenerator
|
|
|
CICategoryGeometryAdjustment
|
|
|
CICategoryGradient
|
|
|
CICategoryHalftoneEffect
|
|
|
CICategorySharpen
|
|
|
CICategoryStylyize
|
|
|
CICategoryTileEffect
|
|
|
CICategoryTransition
|
|
|
|
|
|
### Getting the attributes of a CoreImage filter
|
|
|
|
|
|
To be able to create a property list or a json object that you can setup a core image filter in a filter chain, you need to know what the keys are for the filter that can be set, and what their expected range is. To get that information about a filter you can request "imagefilterattribute" property from the "imagefilterchain" type. The information can be returned in one of 3 ways. Either as a json string (see the example below) or saved to a json or a plist file (-jsonfile, -plistfile). If saving to a file then after the (-jsonfile, -plistfile) option you need to provide a file path.
|
|
|
To be able to create a property list or a json object that you use to setup a core image filter in a filter chain, you need to know what the list of keys are for each filter and what their expected range of values is. To get the filter description you can get the "imagefilterattribute" property from the "imagefilterchain" type. The information can be returned in one of 3 ways. Either as a json string (see the example below) or saved to a json or a plist file (-jsonfile, -plistfile). If saving to a file then after the (-jsonfile, -plistfile) option you need to provide a file path.
|
|
|
|
|
|
The following shows you how to get the properties about the CIDroste filter as a json string.
|
|
|
|
... | ... | @@ -43,7 +43,7 @@ This returns the non human friendly version of the json string. To quickly view |
|
|
|
|
|
### Setting up the properties for a filter
|
|
|
|
|
|
All but a few of the core image filters require inputs. All the numerical inputs for the filters have default values that means for a quick and dirty test of a filter you don't need to assign these values. Other input types like images, require an input as they don't have a default, and input types like CIVector and CIColor have default values, but the default values really need to be overridden.
|
|
|
All but a few of the core image filters require inputs. All the numerical inputs for the filters have default values that means for a quick and dirty test of a filter you don't need to assign these values. Other input types like images, require an input as they don't have a default, and input types like CIVector and CIColor have default values, but the default values need to be overridden.
|
|
|
|
|
|
Each filter in a filter chain, is described by the filter name, a render destination, a name identifier and a list of properties to be assigned. The filter name is the core image name of the filter to be created, and the name identifier is used to chain together filters in a filter chain. Filters later in the chain can reference earlier filters by their name identifier and assign any of their input images to the output image of an earlier filter.
|
|
|
|
... | ... | @@ -69,9 +69,9 @@ Each filter in a filter chain, is described by the filter name, a render destina |
|
|
]
|
|
|
}
|
|
|
|
|
|
In the above json example, the core image filter to be created is a Core Image Unsharp Mask filter. The filter is given the identifier "com.yvs.renderingfilterchain.example.unsharpmask" and the filter takes three inputs. These are the input radius, which takes a numeric value, input intensity which also takes a numeric value the input image which of course takes an image.
|
|
|
In the above json example, the core image filter to be created is a Core Image Unsharp Mask filter. The filter is given the identifier "com.yvs.renderingfilterchain.example.unsharpmask" and the filter takes three inputs. These are the input radius, which takes a numeric value, input intensity which also takes a numeric value and an input image which takes a dictionary/json object which describes where to get the image from.
|
|
|
|
|
|
When an input is an image, then the input value is a way to obtain the image and is a json object. The image can be sourced as the output image of a previous filter in the filter chain and if that was the case then the key in the object would be "cifilterindex" and the value is an index to an earlier filter in the filter chain or a key "mifiltername" and the value would be a string which is the name identifier. If the image is sourced from a bitmap context then the key in the object would be "objectreference" as in the above example which refers to a base object with reference 0. The image can also come from an image importer object in which case the "objectreference" key is also used but that a "imageindex" key should also be supplied specifying the index of the image in the image file. If "imageindex" is not specified and the object reference refers to an image importer object then "imageindex" defaults to 0.
|
|
|
When an input is an image, then the input value is a way to obtain the image and is a json object. The image can be sourced as the output image of a previous filter in the filter chain and if that was the case then the key in the object would be "cifilterindex" and the value is an index to an earlier filter in the filter chain or a key "mifiltername" and the value would be a string which is the name identifier of the earlier filter. If the image is sourced from a bitmap context then the key in the object would be "objectreference" as in the above example which refers to a base object with reference 0. The image can also come from an image importer object in which case the "objectreference" key is also used but that a "imageindex" key should also be supplied specifying the index of the image in the image file. If "imageindex" is not specified and the object reference refers to an image importer object then "imageindex" defaults to 0.
|
|
|
|
|
|
When a filter takes a numeric input, then the "cifiltervalueclass" key is not needed but for all other input types specifying the value class is required and in the above example "CIImage" is demonstrated. Other "cifiltervalueclass" keys are "CIVector", "CIColor", "NSString". In the case of both CIVector and CIColor the type of the value for the key "cifiltervalue" is a string, the purpose of the "cifiltervalueclass" key is to inform Moving Images what object type the string needs to be converted into before it can be assigned to the filter.
|
|
|
|
... | ... | |