... | ... | @@ -268,7 +268,7 @@ Method 2 using the filter index in the filter chain of an earlier filter, in thi |
|
|
}
|
|
|
}
|
|
|
|
|
|
If the input image for a filter is from a base object like a bitmap context or a image importer object then the "objectreference" key is required and it's value is a base object reference, or alternatively the two keys "objecttype" and "objectname" are required. The value for the "objecttype" key will be "bitmapcontext" or "imageimporter". The value for the "objectname" is the name of the base object given to it when it was created.
|
|
|
If the input image for a filter is from a base object like a bitmap context or a image importer object then the "objectreference" key is required and it's value is a base object reference, or alternatively the two keys "objecttype" and "objectname" are required. The value for the "objecttype" key will be "bitmapcontext", "imageimporter" or "nsgraphicscontext". The value for the "objectname" is the name of the base object given to it when it was created.
|
|
|
|
|
|
{
|
|
|
"cifilterkey": "inputImage",
|
... | ... | @@ -278,6 +278,8 @@ If the input image for a filter is from a base object like a bitmap context or a |
|
|
}
|
|
|
}
|
|
|
|
|
|
The documentation for [creating a image filter chain base object in ruby](CreatingObjectsRuby#creating-an-image-filter-chain-object) demonstrates making the input image property and adding it to the list of properties.
|
|
|
|
|
|
If the base object reference identifies a "imageimporter" object or if the "objecttype" is "imageimporter" then a "imageindex" should also be supplied which refers to the index of the image in the image file. If the "imageindex" key is not supplied then the image index value defaults to 0. The image index in a image file starts at 0, so in the example below the image referred to is the second image in the image file.
|
|
|
|
|
|
{
|
... | ... | @@ -294,7 +296,7 @@ If the base object reference identifies a "imageimporter" object or if the "obje |
|
|
|
|
|
#### Render Destination
|
|
|
|
|
|
At present the only object type that can be a render destination is the object type "bitmapcontext". This will change. The rendering destination is specified as a plist dictionary/JSON object. This object can be defined in one of two ways, by specifying a value for the key "objectreference" which is a reference to the base object that is the destination for the image filter chain render, or by setting the value for the key "objecttype" which for now will be "bitmapcontext" and setting the value for the key "objectname" which is the name given to the base object when it was created. There will be more values for the key "objecttype" than "bitmapcontext" in the future, do not assume that this value will remain invariant.
|
|
|
The bitmapcontext and nsgraphicscontext (window) objects are the the only ones that can be render destinations for the image filter chain. The rendering destination is specified as a plist dictionary/JSON object. This object can be defined in one of two ways, by specifying a value for the key "objectreference" which is a reference to the base object that is the destination for the image filter chain render, or by setting the value for the key "objecttype" which for now will be "bitmapcontext" and setting the value for the key "objectname" which is the name given to the base object when it was created. There will be more values for the key "objecttype" than "bitmapcontext" in the future, do not assume that this value will remain invariant.
|
|
|
|
|
|
Render destination example 1:
|
|
|
|
... | ... | @@ -333,6 +335,21 @@ At render time you can modify filter properties of the filters in the filter cha |
|
|
|
|
|
The following demonstrates rendering the filter chain after updating the "inputScale" property of the bump distortion filter to -0.0304.
|
|
|
|
|
|
```ruby
|
|
|
render_property = MIFilterRenderProperty.make_renderproperty_withfilternameid(
|
|
|
key: :inputScale,
|
|
|
value: -0.0304,
|
|
|
filtername_id: :bumpdistortion)
|
|
|
render_filterchain = MIFilterChainRender.new
|
|
|
render_filterchain.add_filterproperty(render_property)
|
|
|
render_filterchain_command = CommandModule.make_createimagefilterchain(
|
|
|
render_filterchain,
|
|
|
name: :documentationimagefilterchain)
|
|
|
Smig.perform_command(render_filterchain_command)
|
|
|
```
|
|
|
|
|
|
The command line equivalent with the JSON already created:
|
|
|
|
|
|
smig doaction -renderfilterchain -object 3 -jsonstring '{"cifilterproperties":[{"cifilterkey":"inputScale","cifiltervalue":-0.0304,"mifiltername":"bumpdistortion"}]}'
|
|
|
|
|
|
All properties except the source for input images can be changed. This does not mean that input images do not change between each time the filter chain is rendered. If the input image is the output image of a filter earlier in the filter chain then if that output image changes then the input image will capture that change. If the input image is sourced from a "bitmapcontext" base object then whenever the contents of the "bitmapcontext" changes the filter chain object knows that it needs to update the image it uses next time the filter chain is rendered.
|
... | ... | |