-
Notifications
You must be signed in to change notification settings - Fork 0
/
QTVectors.c
executable file
·525 lines (430 loc) · 20.6 KB
/
QTVectors.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
//////////
//
// File: QTVectors.c
//
// Contains: QuickTime vector drawing support for QuickTime movies.
//
// Written by: Tim Monroe
// Based largely on VectorSample code by Tom Dowdy(?).
//
// Copyright: © 1997-1998 by Apple Computer, Inc., all rights reserved.
//
// Change History (most recent first):
//
// <9> 03/17/00 rtm made changes to get things running under CarbonLib
// <8> 09/30/98 rtm tweaked call to AddMovieResource to create single-fork movies
// <7> 03/12/98 rtm removed NewHandleClear calls before CurveCreateVectorStream and CurveNewPath
// (which allocate the handles themselves)
// <6> 01/06/98 rtm minor clean-up
// <5> 11/14/97 rtm removed endian macros on parameters to CurveAddAtomToVectorStream;
// Windows works better now, but still not perfect
// (e.g., CurveInsertPointIntoPath seems to ignore ptIsOnPath parameter)
// <4> 11/13/97 rtm added USE_CURVE_INSERT_POINT_INTO_PATH symbol for easier testing
// <3> 11/05/97 rtm got raw data stream working on Windows; the Curve Utilities seem broken on Windows
// <2> 11/04/97 rtm added constants; added comments parsing atoms; reworked using Curve Utilities
// <1> 11/03/97 rtm first file
//
//////////
#include <FixMath.h>
#include <Fonts.h>
#include <GXTypes.h>
#include <ImageCodec.h>
#include <ImageCompression.h>
#include <MacTypes.h>
#include <MacWindows.h>
#include <Movies.h>
#include <QuickDraw.h>
#include <QuickTimeComponents.h>
#include <StandardFile.h>
#include <Sound.h>
#include "QTVectors.h"
// the following compiler symbol is used to select whether, when using the Curve Utilities,
// we call CurveInsertPointIntoPath or CurveAddAtomToVectorStream
#define USE_CURVE_INSERT_POINT_INTO_PATH 1
//////////
//
// QTVectors_CreateVectorMovie
// Create a movie containing some QuickTime vector shapes.
//
// Currently we support two ways of building the vector data:
// * kUseRawDataStream: build the vector data using a stream of raw hard-coded data
// * kUseCurveUtilities: build the vector data using the Curve Utilities API
//
//////////
void QTVectors_CreateVectorMovie (UInt32 theBuildAtomMethod)
{
Handle myHandle = NULL;
ImageDescriptionHandle mySampleDesc = NULL;
short myResRefNum = 0;
short myResID = movieInDataForkResID;
Movie myMovie = NULL;
Track myTrack;
Media myMedia;
FSSpec myFile;
Boolean myIsSelected = false;
Boolean myIsReplacing = false;
StringPtr myPrompt = QTUtils_ConvertCToPascalString(kVectorSavePrompt);
StringPtr myFileName = QTUtils_ConvertCToPascalString(kVectorSaveMovieFileName);
ComponentInstance myComponent;
ComponentResult myResult;
long myFlags = createMovieFileDeleteCurFile | createMovieFileDontCreateResFile;
OSErr myErr = noErr;
// METHOD ONE: use a raw data stream
if (theBuildAtomMethod == kUseRawDataStream) {
// kUseRawDataStream: build the vector data using a stream of hard-coded raw data
// NOTE: the data in the stream *must* be big-endian, since it's stored in a QuickTime atom container.
long myPath[] = {
EndianU32_NtoB(kSizeOfSizeAndTagFields + sizeof(long)), EndianU32_NtoB(kCurveAntialiasControlAtom),
EndianU32_NtoB(kCurveAntialiasOn),
EndianU32_NtoB(kSizeOfSizeAndTagFields + sizeof(long)), EndianU32_NtoB(kCurveFillTypeAtom),
EndianU32_NtoB(gxEvenOddFill),
// a big white enclosing rectangle (600 x 600)
EndianU32_NtoB(kSizeOfSizeAndTagFields + sizeof(ARGBColor)), EndianU32_NtoB(kCurveARGBColorAtom),
EndianU32_NtoB(0xffffffff), // alpha, red
EndianU32_NtoB(0xffffffff), // green, blue
// it's white!
EndianU32_NtoB(kSizeOfSizeAndTagFields + sizeof(long)*11), EndianU32_NtoB(kCurvePathAtom),
EndianU32_NtoB(1), // one contour in path
EndianU32_NtoB(4), // four points in path
EndianU32_NtoB(0x00000000), // all points are on the curve: it's a rectangle!
EndianU32_NtoB(0x00000000), EndianU32_NtoB(0x00000000), // top left
EndianU32_NtoB(0x02580000), EndianU32_NtoB(0x00000000), // top right
EndianU32_NtoB(0x02580000), EndianU32_NtoB(0x02580000), // bottom right
EndianU32_NtoB(0x00000000), EndianU32_NtoB(0x02580000), // bottom left
// a black rounded square, centered at 150,150
EndianU32_NtoB(kSizeOfSizeAndTagFields + sizeof(ARGBColor)), EndianU32_NtoB(kCurveARGBColorAtom),
EndianU32_NtoB(0x00000000), // alpha, red
EndianU32_NtoB(0x00000000), // green, blue
// it's black!
EndianU32_NtoB(kSizeOfSizeAndTagFields + sizeof(long)*11), EndianU32_NtoB(kCurvePathAtom),
EndianU32_NtoB(1), // one contour in path
EndianU32_NtoB(4), // four points in path
EndianU32_NtoB(0xffffffff), // all points are off the curve: it's a rounded square!
EndianU32_NtoB(0x00640000), EndianU32_NtoB(0x00640000),
EndianU32_NtoB(0x00C80000), EndianU32_NtoB(0x00640000),
EndianU32_NtoB(0x00C80000), EndianU32_NtoB(0x00C80000),
EndianU32_NtoB(0x00640000), EndianU32_NtoB(0x00C80000),
EndianU32_NtoB(kSizeOfSizeAndTagFields + sizeof(long)), EndianU32_NtoB(kCurveFillTypeAtom),
EndianU32_NtoB(gxEvenOddFill),
EndianU32_NtoB(kSizeOfSizeAndTagFields + sizeof(long)), EndianU32_NtoB(kCurvePenThicknessAtom),
EndianU32_NtoB(0x100000),
// enable linear gradient for all following atoms
EndianU32_NtoB(kSizeOfSizeAndTagFields + sizeof(long)), EndianU32_NtoB(kCurveGradientTypeAtom),
EndianU32_NtoB(kLinearGradient),
// define the gradient: red -> green -> red -> blue
EndianU32_NtoB(kSizeOfSizeAndTagFields + sizeof(GradientColorRecord)*4), EndianU32_NtoB(kCurveGradientRecordAtom),
EndianU32_NtoB(0xffffffff), // gradient color record 1:
EndianU32_NtoB(0x00000000), // red
EndianU32_NtoB(0x00000000), // beginning of gradient
EndianU32_NtoB(0x77770000), // gradient color record 2:
EndianU32_NtoB(0xffff0000), // green
EndianU32_NtoB(0x00004000),
EndianU32_NtoB(0x3333ffff), // gradient color record 3:
EndianU32_NtoB(0x00000000), // red
EndianU32_NtoB(0x0000C000),
EndianU32_NtoB(0xffff0000), // gradient color record 4:
EndianU32_NtoB(0x0000ffff), // blue
EndianU32_NtoB(0x00010000), // end of gradient
EndianU32_NtoB(kSizeOfSizeAndTagFields + sizeof(long)), EndianU32_NtoB(kCurveGradientAngleAtom),
EndianU32_NtoB(0x00450000), // gradient at 45û angle
// a green rectangle, centered at 40,40, painted with a linear gradient
EndianU32_NtoB(kSizeOfSizeAndTagFields + sizeof(ARGBColor)), EndianU32_NtoB(kCurveARGBColorAtom),
EndianU32_NtoB(0x00000000), // alpha, red
EndianU32_NtoB(0xffff0000), // green, blue
// it's green!
EndianU32_NtoB(kSizeOfSizeAndTagFields + sizeof(long)*11), EndianU32_NtoB(kCurvePathAtom),
EndianU32_NtoB(1), // one contour in path
EndianU32_NtoB(4), // four points in path
EndianU32_NtoB(0x00000000), // all points are on the curve: it's a rectangle!
EndianU32_NtoB(0x00100000), EndianU32_NtoB(0x00100000),
EndianU32_NtoB(0x00400000), EndianU32_NtoB(0x00100000),
EndianU32_NtoB(0x00400000), EndianU32_NtoB(0x00400000),
EndianU32_NtoB(0x00100000), EndianU32_NtoB(0x00400000),
// disable gradient for all following atoms (since no atom data)
EndianU32_NtoB(kSizeOfSizeAndTagFields), EndianU32_NtoB(kCurveGradientRecordAtom),
// a red rounded square, centered at 50,50
EndianU32_NtoB(kSizeOfSizeAndTagFields + sizeof(ARGBColor)), EndianU32_NtoB(kCurveARGBColorAtom),
EndianU32_NtoB(0x3333ffff), // alpha, red
EndianU32_NtoB(0x00000000), // green, blue
// it's red!
EndianU32_NtoB(kSizeOfSizeAndTagFields + sizeof(long)*11), EndianU32_NtoB(kCurvePathAtom),
EndianU32_NtoB(1L), // one contour in path
EndianU32_NtoB(4L), // four points in path
EndianU32_NtoB(0xffffffff), // all points are off the curve: it's a rounded square!
EndianU32_NtoB(0x001e0000), EndianU32_NtoB(0x001e0000),
EndianU32_NtoB(0x00460000), EndianU32_NtoB(0x001e0000),
EndianU32_NtoB(0x00460000), EndianU32_NtoB(0x00460000),
EndianU32_NtoB(0x001e0000), EndianU32_NtoB(0x00460000),
EndianU32_NtoB(kSizeOfZeroAtomHeader), EndianU32_NtoB(kCurveEndAtom),
};
myHandle = NewHandle(sizeof(myPath));
if (myHandle == NULL)
goto bail;
BlockMove(myPath, *myHandle, sizeof(myPath));
} // end of kUseRawDataStream
// METHOD TWO: use the Curve Utilities API
if (theBuildAtomMethod == kUseCurveUtilities) {
// kUseCurveUtilities: build the vector data using the Curve Utilities API
Handle myPath;
gxPoint myPoint;
long myAtomData[14];
ARGBColor myColor;
GradientColorRecord myGradients[4];
// open the vector codec; we'll need it for some subsequent calls
myComponent = OpenDefaultComponent(decompressorComponentType, kVectorCodecType);
if (myComponent == NULL)
goto bail;
// create a new, empty vector data stream
myResult = CurveCreateVectorStream(myComponent, &myHandle);
if (myResult != noErr)
goto bail;
// now start adding atoms holding the vector data
// set antialiasing on
myAtomData[0] = EndianU32_NtoB(kCurveAntialiasOn);
CurveAddAtomToVectorStream(myComponent, kCurveAntialiasControlAtom, sizeof(long), myAtomData, myHandle);
// set fill type
myAtomData[0] = EndianU32_NtoB(gxEvenOddFill);
CurveAddAtomToVectorStream(myComponent, kCurveFillTypeAtom, sizeof(long), myAtomData, myHandle);
// a big white enclosing rectangle (600 x 600)
myColor.alpha = EndianU16_NtoB(0xffff);
myColor.red = EndianU16_NtoB(0xffff);
myColor.green = EndianU16_NtoB(0xffff);
myColor.blue = EndianU16_NtoB(0xffff);
CurveAddAtomToVectorStream(myComponent, kCurveARGBColorAtom, sizeof(ARGBColor), &myColor, myHandle);
#if USE_CURVE_INSERT_POINT_INTO_PATH
// create a new, empty path
CurveNewPath(myComponent, &myPath);
myPoint.x = 0x00000000;
myPoint.y = 0x00000000;
CurveInsertPointIntoPath(myComponent, &myPoint, myPath, 0, 0, true);
myPoint.x = 0x02580000;
myPoint.y = 0x00000000;
CurveInsertPointIntoPath(myComponent, &myPoint, myPath, 0, 1, true);
myPoint.x = 0x02580000;
myPoint.y = 0x02580000;
CurveInsertPointIntoPath(myComponent, &myPoint, myPath, 0, 2, true);
myPoint.x = 0x00000000;
myPoint.y = 0x02580000;
CurveInsertPointIntoPath(myComponent, &myPoint, myPath, 0, 3, true);
// add the 'path' atom to the vector data stream
CurveAddPathAtomToVectorStream(myComponent, myPath, myHandle);
DisposeHandle(myPath);
#else
myAtomData[0] = EndianU32_NtoB(1L);
myAtomData[1] = EndianU32_NtoB(4L);
myAtomData[2] = EndianU32_NtoB(0x00000000);
myAtomData[3] = EndianU32_NtoB(0x00000000);
myAtomData[4] = EndianU32_NtoB(0x00000000);
myAtomData[5] = EndianU32_NtoB(0x02580000);
myAtomData[6] = EndianU32_NtoB(0x00000000);
myAtomData[7] = EndianU32_NtoB(0x02580000);
myAtomData[8] = EndianU32_NtoB(0x02580000);
myAtomData[9] = EndianU32_NtoB(0x00000000);
myAtomData[10] = EndianU32_NtoB(0x02580000);
CurveAddAtomToVectorStream(myComponent, kCurvePathAtom, sizeof(long)*11, myAtomData, myHandle);
#endif
// a black rounded square, centered at 150,150
myColor.alpha = EndianU16_NtoB(0x0000);
myColor.red = EndianU16_NtoB(0x0000);
myColor.green = EndianU16_NtoB(0x0000);
myColor.blue = EndianU16_NtoB(0x0000);
CurveAddAtomToVectorStream(myComponent, kCurveARGBColorAtom, sizeof(ARGBColor), &myColor, myHandle);
#if USE_CURVE_INSERT_POINT_INTO_PATH
// create a new, empty path
CurveNewPath(myComponent, &myPath);
myPoint.x = 0x00640000;
myPoint.y = 0x00640000;
CurveInsertPointIntoPath(myComponent, &myPoint, myPath, 0, 0, false);
myPoint.x = 0x00C80000;
myPoint.y = 0x00640000;
CurveInsertPointIntoPath(myComponent, &myPoint, myPath, 0, 1, false);
myPoint.x = 0x00C80000;
myPoint.y = 0x00C80000;
CurveInsertPointIntoPath(myComponent, &myPoint, myPath, 0, 2, false);
myPoint.x = 0x00640000;
myPoint.y = 0x00C80000;
CurveInsertPointIntoPath(myComponent, &myPoint, myPath, 0, 3, false);
// add the 'path' atom to the vector data stream
CurveAddPathAtomToVectorStream(myComponent, myPath, myHandle);
DisposeHandle(myPath);
#else
myAtomData[0] = EndianU32_NtoB(1L);
myAtomData[1] = EndianU32_NtoB(4L);
myAtomData[2] = EndianU32_NtoB(0xffffffff);
myAtomData[3] = EndianU32_NtoB(0x00640000);
myAtomData[4] = EndianU32_NtoB(0x00640000);
myAtomData[5] = EndianU32_NtoB(0x00C80000);
myAtomData[6] = EndianU32_NtoB(0x00640000);
myAtomData[7] = EndianU32_NtoB(0x00C80000);
myAtomData[8] = EndianU32_NtoB(0x00C80000);
myAtomData[9] = EndianU32_NtoB(0x00640000);
myAtomData[10] = EndianU32_NtoB(0x00C80000);
CurveAddAtomToVectorStream(myComponent, kCurvePathAtom, sizeof(long)*11, myAtomData, myHandle);
#endif
// set fill type
myAtomData[0] = EndianU32_NtoB(gxEvenOddFill);
CurveAddAtomToVectorStream(myComponent, kCurveFillTypeAtom, sizeof(long), myAtomData, myHandle);
// set pen thickness
myAtomData[0] = EndianU32_NtoB(0x100000);
CurveAddAtomToVectorStream(myComponent, kCurvePenThicknessAtom, sizeof(long), myAtomData, myHandle);
// enable linear gradient for all following atoms
myAtomData[0] = EndianU32_NtoB(kLinearGradient);
CurveAddAtomToVectorStream(myComponent, kCurveGradientTypeAtom, sizeof(long), myAtomData, myHandle);
// define the gradient: red -> green -> red -> blue
myGradients[0].thisColor.alpha = EndianU16_NtoB(0xffff);
myGradients[0].thisColor.red = EndianU16_NtoB(0xffff);
myGradients[0].thisColor.green = EndianU16_NtoB(0x0000);
myGradients[0].thisColor.blue = EndianU16_NtoB(0x0000);
myGradients[0].endingPercentage = EndianU32_NtoB(0x00000000);
myGradients[1].thisColor.alpha = EndianU16_NtoB(0x7777);
myGradients[1].thisColor.red = EndianU16_NtoB(0x0000);
myGradients[1].thisColor.green = EndianU16_NtoB(0xffff);
myGradients[1].thisColor.blue = EndianU16_NtoB(0x0000);
myGradients[1].endingPercentage = EndianU32_NtoB(0x00004000);
myGradients[2].thisColor.alpha = EndianU16_NtoB(0x3333);
myGradients[2].thisColor.red = EndianU16_NtoB(0xffff);
myGradients[2].thisColor.green = EndianU16_NtoB(0x0000);
myGradients[2].thisColor.blue = EndianU16_NtoB(0x0000);
myGradients[2].endingPercentage = EndianU32_NtoB(0x0000C000);
myGradients[3].thisColor.alpha = EndianU16_NtoB(0xffff);
myGradients[3].thisColor.red = EndianU16_NtoB(0x0000);
myGradients[3].thisColor.green = EndianU16_NtoB(0x0000);
myGradients[3].thisColor.blue = EndianU16_NtoB(0xffff);
myGradients[3].endingPercentage = EndianU32_NtoB(0x00010000);
CurveAddAtomToVectorStream(myComponent, kCurveGradientRecordAtom, sizeof(GradientColorRecord)*4, myGradients, myHandle);
// set gradient angle
myAtomData[0] = EndianU32_NtoB(0x00450000);
CurveAddAtomToVectorStream(myComponent, kCurveGradientAngleAtom, sizeof(long), myAtomData, myHandle);
// a green rectangle, centered at 40,40, painted with a linear gradient
myColor.alpha = EndianU16_NtoB(0x0000);
myColor.red = EndianU16_NtoB(0x0000);
myColor.green = EndianU16_NtoB(0xffff);
myColor.blue = EndianU16_NtoB(0x0000);
CurveAddAtomToVectorStream(myComponent, kCurveARGBColorAtom, sizeof(ARGBColor), &myColor, myHandle);
#if USE_CURVE_INSERT_POINT_INTO_PATH
// create a new, empty path
CurveNewPath(myComponent, &myPath);
myPoint.x = 0x00100000;
myPoint.y = 0x00100000;
CurveInsertPointIntoPath(myComponent, &myPoint, myPath, 0, 0, true);
myPoint.x = 0x00400000;
myPoint.y = 0x00100000;
CurveInsertPointIntoPath(myComponent, &myPoint, myPath, 0, 1, true);
myPoint.x = 0x00400000;
myPoint.y = 0x00400000;
CurveInsertPointIntoPath(myComponent, &myPoint, myPath, 0, 2, true);
myPoint.x = 0x00100000;
myPoint.y = 0x00400000;
CurveInsertPointIntoPath(myComponent, &myPoint, myPath, 0, 3, true);
// add the 'path' atom to the vector data stream
CurveAddPathAtomToVectorStream(myComponent, myPath, myHandle);
DisposeHandle(myPath);
#else
myAtomData[0] = EndianU32_NtoB(1L);
myAtomData[1] = EndianU32_NtoB(4L);
myAtomData[2] = EndianU32_NtoB(0x00000000);
myAtomData[3] = EndianU32_NtoB(0x00100000);
myAtomData[4] = EndianU32_NtoB(0x00100000);
myAtomData[5] = EndianU32_NtoB(0x00400000);
myAtomData[6] = EndianU32_NtoB(0x00100000);
myAtomData[7] = EndianU32_NtoB(0x00400000);
myAtomData[8] = EndianU32_NtoB(0x00400000);
myAtomData[9] = EndianU32_NtoB(0x00100000);
myAtomData[10] = EndianU32_NtoB(0x00400000);
CurveAddAtomToVectorStream(myComponent, kCurvePathAtom, sizeof(long)*11, myAtomData, myHandle);
#endif
// disable gradient for all following atoms (since no atom data)
CurveAddAtomToVectorStream(myComponent, kCurveGradientTypeAtom, 0, NULL, myHandle);
// a red rounded square, centered at 50,50
myColor.alpha = EndianU16_NtoB(0x3333);
myColor.red = EndianU16_NtoB(0xffff);
myColor.green = EndianU16_NtoB(0x0000);
myColor.blue = EndianU16_NtoB(0x0000);
CurveAddAtomToVectorStream(myComponent, kCurveARGBColorAtom, sizeof(ARGBColor), &myColor, myHandle);
#if USE_CURVE_INSERT_POINT_INTO_PATH
// create a new, empty path
CurveNewPath(myComponent, &myPath);
myPoint.x = 0x001e0000;
myPoint.y = 0x001e0000;
CurveInsertPointIntoPath(myComponent, &myPoint, myPath, 0, 0, false);
myPoint.x = 0x00460000;
myPoint.y = 0x001e0000;
CurveInsertPointIntoPath(myComponent, &myPoint, myPath, 0, 1, false);
myPoint.x = 0x00460000;
myPoint.y = 0x00460000;
CurveInsertPointIntoPath(myComponent, &myPoint, myPath, 0, 2, false);
myPoint.x = 0x001e0000;
myPoint.y = 0x00460000;
CurveInsertPointIntoPath(myComponent, &myPoint, myPath, 0, 3, false);
// add the 'path' atom to the vector data stream
CurveAddPathAtomToVectorStream(myComponent, myPath, myHandle);
DisposeHandle(myPath);
#else
myAtomData[0] = EndianU32_NtoB(1L);
myAtomData[1] = EndianU32_NtoB(4L);
myAtomData[2] = EndianU32_NtoB(0xffffffff);
myAtomData[3] = EndianU32_NtoB(0x001e0000);
myAtomData[4] = EndianU32_NtoB(0x001e0000);
myAtomData[5] = EndianU32_NtoB(0x00460000);
myAtomData[6] = EndianU32_NtoB(0x001e0000);
myAtomData[7] = EndianU32_NtoB(0x00460000);
myAtomData[8] = EndianU32_NtoB(0x00460000);
myAtomData[9] = EndianU32_NtoB(0x001e0000);
myAtomData[10] = EndianU32_NtoB(0x00460000);
CurveAddAtomToVectorStream(myComponent, kCurvePathAtom, sizeof(long)*11, myAtomData, myHandle);
#endif
// add the 'zero' atom to the vector data stream
CurveAddZeroAtomToVectorStream(myComponent, myHandle);
} // end of kUseCurveUtilities
// create the image description
mySampleDesc = (ImageDescriptionHandle)NewHandleClear(sizeof(ImageDescription));
if (mySampleDesc == NULL)
goto bail;
// fill in the fields of the image description
(**mySampleDesc).idSize = sizeof(ImageDescription);
(**mySampleDesc).cType = kVectorCodecType;
(**mySampleDesc).vendor = kAppleManufacturer;
(**mySampleDesc).temporalQuality = codecNormalQuality;
(**mySampleDesc).spatialQuality = codecNormalQuality;
(**mySampleDesc).width = 300;
(**mySampleDesc).height = 300;
(**mySampleDesc).hRes = 72L << 16;
(**mySampleDesc).vRes = 72L << 16;
(**mySampleDesc).dataSize = 0L;
(**mySampleDesc).frameCount = 1;
(**mySampleDesc).depth = 0;
(**mySampleDesc).clutID = -1;
// prompt user for new file name
QTFrame_PutFile(myPrompt, myFileName, &myFile, &myIsSelected, &myIsReplacing);
if (!myIsSelected)
goto bail;
// create a movie file for the destination movie
myErr = CreateMovieFile(&myFile, FOUR_CHAR_CODE('TVOD'), smCurrentScript, myFlags, &myResRefNum, &myMovie);
if (myErr != noErr)
goto bail;
// create the vector track and media
myTrack = NewMovieTrack(myMovie, FixDiv(300, 1), FixDiv(300, 1), kNoVolume);
myMedia = NewTrackMedia(myTrack, VideoMediaType, 600, NULL, 0);
// create the vector media sample
BeginMediaEdits(myMedia);
myErr = AddMediaSample(myMedia, myHandle, 0, GetHandleSize(myHandle), 600, (SampleDescriptionHandle)mySampleDesc, 1, 0, NULL);
if (myErr != noErr)
goto bail;
EndMediaEdits(myMedia);
// add the media to the track
InsertMediaIntoTrack(myTrack, 0, 0, GetMediaDuration(myMedia), fixed1);
AddMovieResource(myMovie, myResRefNum, &myResID, NULL);
bail:
free(myPrompt);
free(myFileName);
if (mySampleDesc != NULL)
DisposeHandle((Handle)mySampleDesc);
if (myResRefNum != 0)
CloseMovieFile(myResRefNum);
if (myHandle != NULL)
DisposeHandle(myHandle);
if (myMovie != NULL)
DisposeMovie(myMovie);
if (myComponent != NULL)
CloseComponent(myComponent);
}