Joe Maller: Joe's Debug and Explore Filters: Joe's Simple Filldescriptive blurb, should be one line, meant to get search engines.
There are two ways to think about how this filter will work. At it's most basic, the filter will fill the source clip with a percentage of color. However, I prefer to think about filters as if I were going to build the effect manually in Photoshop:
The filter will create a layer of color. That layer of color will be composited onto the source clip at the specified opacity.
Understanding how to build these with existing tools will help to bridge the gap between understood image processes and abstracted programmatic image processes.
Every FXScript begins with a few definitions. These tell Final Cut Pro about what kind of FXScript this is and where it should go in the menus.
The first line sets both the type of script, in this case a
FXScript provides many kinds of inputs, this filter uses a color selector to choose the fill color and a slider to set the opacity.
The first line creates a color selector with a default yellowish color. The first number after color is the Alpha value (ignored by the visual color picker), the second is Red, third Green and fourth Blue. The selected color is stored in the
Opacity uses a simple slider from 0 to 100. The default setting is 100.
The last line,
This is the most important line in every FXScript:
That line divides the filter between the inputs which are set globally, and the actual processing which processes every frame of a clip.
Compositing and Output
Below the code comes the actual processes which execute the filter. Thinking like Photoshop again, this uses the dest channel as an extra layer and fills it with color. This color "layer" is then applied onto the source image.
ChannelFill can fill all the channels or none of the channels. This function applies a completely opaque copy of
If the filter was to stop at this point it's effect would be to completely fill the source clip with the selected color. Whatever is left in the
Matte is a simple compositing funtion similar to using layer opacity in Photoshop. The image buffer
The source code above is slightly different from the source code included in the Joe's Filters download. The code above removes three commented lines which were leftover from an earlier version of the filter. Because those lines are just comments (preceded by two slash characters "//") both versions function identically. In the earlier version, the filter created an additional image buffer for ChannelFill instead of using