Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: QTKit and NSImage not playing nice



It's an implementation detail of QuickTime. In order to render to a movie flle, you need an off-screen graphics world (GWorld) in which to draw the frames. Otherwise, they get dumped, one after the other, into the first compatible graphics context QT finds, which ends up being a flipped context in a window somewhere.

Use QTNewGWorld() to create an off-screen GWorld after calling - [QTMovie movieWithQuickTimeMovie:disposeWhenDone:error:] during your movie initialization. After checking for success, use SetMovieGWorld () to set the GWorld for the movie.


-- m-s

On 21 Mar, 2007, at 21:17, Alan Smith wrote:

Hi all,

I'm trying to create a QTMovie from PDF data. The movie will scroll
down the PDF at a set speed with a set frame height. The only trouble
I'm having is at the end of creating the movie the first frame is
drawn in the upper-left hand corner of my screen. I'm compositing each
image just before adding it to the movie, if I use a file from disk
the odd behavior described above doesn't occur. Why is that???

Any thoughts and suggestions are welcome, this is a real stumper.

Peace, Alan

Here is my code:

for (i = 0; i <= numFrames; i++)
{
NSLog(@"i = %i", i);

//NSImage *frame = [[NSImage alloc] initWithContentsOfFile: path to a file];
NSImage *frame = [[NSImage alloc] initWithSize: frameSize];

rect = NSMakeRect(0.0, imageYOrigin, frameSize.width, frameSize.height);

[frame lockFocus];
[masterImage compositeToPoint: NSMakePoint(0, 0) fromRect: rect
operation: NSCompositeCopy];
[frame unlockFocus];

[movie addImage: frame forDuration: curTime withAttributes: imageCompression];
NSLog(@"Added image");

[frame release];

imageYOrigin -= currentSpeed;
}


--
// Quotes from yours truly -------------------------
"You don't forget, you just don't remember."
"Maturity resides in the mind."
"Silence is the Universe's greatest gift."
"When the World realizes that religion really is unnecessary, then it
shall evolve."
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/mikey-san% 40bungie.org


This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >QTKit and NSImage not playing nice (From: "Alan Smith" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.