Graphics Reference
In-Depth Information
10.
Save the composition to a
.qtz
file.
11.
If the composition is not already running, click the Run button in the composition
viewer to watch the two videos play back.
Creating Controllable Parameters
The power of using Quartz Compositions is found in its capability to provide inputs and
outputs that are controllable outside of the composition. Our
QCCompositionLayer
provides a way to set any parameter that we have published in the composition.
When we created our composition, we explicitly specified the path to the movie files we
want to use in the Movie Loader patches. What if instead we decide we want to allow the
user to specify the paths to video files to use and pass those paths along to the composi-
tion? This is done by publishing the Movie Location parameters of the Movie Loader
patches.
To publish the Movie Location input parameters, do the following:
1.
In Quartz Composer, Control-click the Movie Location input on the first (top)
Movie Loader patch and select
Published Input > Movie Location
.
2.
Name the input
movie1_location
and press Enter.
3.
Control-click the Movie location input on the other Movie Loader patch and select
Published Input > Movie Location
.
4.
Name the input
movie2_location
and press Enter.
5.
Save the composition.
Now, the locations of the movie files can be set from within our application code. Next,
we create an Xcode project that uses a
QCCompositionLayer
to display the composition.
Creating the Xcode Project
To create our hosting application, do the following:
1.
In Xcode, press Shift-
„
-N and select Cocoa Application in the Project Templates
dialog.
2.
Name the project Dual Video QC Composition and click Save.
3.
Expand the Frameworks group, Control-click the Linked Frameworks subgroup, and
select
Add > Existing Frameworks
.
4.
In the resulting dialog, navigate to
/System/Library/Frameworks
and select both
QuartzCore.framework
and
Quartz.framework
. You need to click Add twice, when
prompted.
5.
Control-click the Classes group and select
Add > New File
.