@@ -295,7 +295,7 @@ The following json object is everything needed to define the filter chain manage
...
@@ -295,7 +295,7 @@ The following json object is everything needed to define the filter chain manage
}
}
```
```
The following ruby script, which can be pasted into a interactive ruby session (irb) and as long as you've done the usual `require 'moving_images'` and `include MovingImages` then the script will generate the same filter chain as described in the json above. The script does a good deal more though, it creates a mask image by drawing text and uses that image as a filter input image and then renders the filter chain multiple times with the "inputScale" property of the bump distortion updated each time the filter chain is rendered to produce an animation.
The following script will generate the same filter chain as described in the json above. The script creates all the base objects needed to render the filter chain, it creates a mask image by drawing text and uses that image as a filter input image and then renders the filter chain multiple times with the "inputScale" property of the bump distortion filter updated each time the filter chain is rendered to produce an animation.
```ruby
```ruby
# Script constants
# Script constants
...
@@ -644,6 +644,80 @@ If the destination rectangle is not specified, then the rectangle drawn to is th
...
@@ -644,6 +644,80 @@ If the destination rectangle is not specified, then the rectangle drawn to is th
}
}
```
```
### Equations and variables when rendering
For an example of drawing shapes using equations and variables please see the [Drawing with equations and variable section](Drawing#drawing-with-equations-and-variables) in the drawing documentation. The ruby code complete example demonstrates how the equations and variables work.
When rendering the filter chain the position and dimensions of the source and destination rectangles can be evaluated as equations. Numerical inputs for filter properties can be equations instead of numbers. The color components for a CIColor of a filter property can be defined as equations when the color is defined as an associative array. The same goes for the components of a CIVector if it is defined as a rectangle or a point in the same way as you would in the drawing example.
This partial ruby code snippet demonstrates how to use equations and apply variables in the rendering filter chain command: