When one video track is drawn on top of another, the top
doesn’t necessarily have to obscure the bottom.
QuickTime gives you the option of specifying a
GraphicsMode to combine pixels from multiple video
layers to create interesting effects.
You can create a
GraphicsMode object to describe
the means of combining overlapping colors. To try it out, take the
previous lab’s code and replace all the matrix stuff
backTrack are created, but before the
MovieController is created) with the following:
GraphicsMode gm = new GraphicsMode (QDConstants.addMax, QDColor.green); VisualMediaHandler foreHandler = (VisualMediaHandler) foreTrack.getMedia( ).getHandler( ); foreHandler.setGraphicsMode(gm); foreTrack.setLayer(-1);
Run this example with ant run-ch08-composit-evideotracks.
When run, this sample program asks you to open two movies, then creates a new movie with video tracks from the source movies’ media, and combines the pixels of the foreground movie with the background, so the foreground appears atop the background. The result is shown in Figure 8-4.
GraphicsMode instructs QuickTime to
apply a specific behavior to combine overlapping pixels. The
GraphicsMode has a
which indicates which kind of behavior to use, and a
QDColor that is used by some behaviors to indicate
a color to operate on. For example, you might use mode
QDColor.green to make all green pixels ...