This filter helped me a great deal while struggling with Joe's Color
Glow and switching between YUV and RGB color spaces. More detail about
YUV and RGB issues with FXScript are discussed on the FXScript
RGB and YUV Color page.
How It Works
There are two main concepts for dealing with color spaces in FXScript,
conversion and assignment. Conversion changes pixel data from one color
space to another, moving the resulting image into a new image buffer.
Assignment doesn't bother with conversion and simply tells FXScript to
interpret the pixel values in the image buffer using the assigned color
space.
This filter offers several conversions between formats. Each is contained
within an if statement. The contents of the first if statement look sort
of like this:
if convert == 1
ConvertImage(src1, dest, kFormatYUV219)
NumToString(kFormatYUV219, textformat, kInteger)
textformat = "PixelFormat: YUV219 (" + textformat
+ ")"
DrawString(textformat, 0, 0, 2, dest, fontcolor,1)
end if
The statement is based on the current selection of convert,
which is the popup menu driving the filter.
ConvertImage(src1, dest, kFormatYUV219)
The above line takes the image data from src1 and places
the YUV conversion of that data into the dest image buffer.
Dest would also be assigned to kFormatYUV219 in the process.
The remaining three lines change the format from a number to a string
(remember that all values seem to be numbers too), adds some English words
to the string to give it meaning and then draws the string onto the dest
image buffer.
There are 10 options but each does pretty much the same thing. The FXScript
RGB and YUV Color page has more information about working with color
spaces.