How can I create a Quicktime movie from a series of generated images?

I need to create a movie from a series of generated images. (I create images based on the results of a physics simulation program.)

I found an Apple sample in QtKitCreateMovie and used this as a starting point. Instead of loading jpg from the application package, I draw NSImage and add NSImage to the movie object. Here is the basic code I used for testing. mMovieis an instance QTMovie:

NSImage *anImage = [[NSImage alloc] initWithSize:NSMakeSize(frameSize, frameSize)];
[anImage lockFocus];

float blendValue;
for (blendValue = 0.0; blendValue <= 1.0; blendValue += 0.05) {
    [[[NSColor blueColor] blendedColorWithFraction:blendValue ofColor:[NSColor redColor]] setFill];
    [NSBezierPath fillRect:NSMakeRect(0, 0, frameSize, frameSize)];
    [mMovie addImage:anImage forDuration:duration withAttributes:myDict];
}
[anImage unlockFocus];
[anImage release];

This works under OS X 10.5, but on OS X 10.6 I get the array index outside of the call restriction addImage:forDuration:withAttributes: ( http://openradar.appspot.com/radar?id=1146401 )

What is the correct way to create a movie under 10.6?

, 10.5, , . , .

+5
1

, .

QTKit. , , , , . , (20 ), (20 ), .

" " - , . QTMovie, , , , representations, , .

-, Leopard (, - , Snow Leopard), , .

- :

float blendValue;
for (blendValue = 0.0; blendValue <= 1.0; blendValue += 0.05) {
    [anImage lockFocus];
    [[NSGraphicsContext currentContext] setShouldAntialias:NO];
    [[[NSColor blueColor] blendedColorWithFraction:blendValue ofColor:[NSColor redColor]] setFill];
    [NSBezierPath fillRect:NSMakeRect(0, 0, frameSize, frameSize)];
    [anImage unlockFocus];

    [mMovie addImage:anImage forDuration:duration withAttributes:myDict];
}
+3

All Articles