• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: QTKit and NSImage not playing nice
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: QTKit and NSImage not playing nice


  • Subject: Re: QTKit and NSImage not playing nice
  • From: Michael Watson <email@hidden>
  • Date: Wed, 21 Mar 2007 22:12:38 -0400

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:
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:
This email sent to email@hidden


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

  • Prev by Date: Re: Need help setting up KVO
  • Next by Date: Weird behavior after exiting full screen OpenGL application
  • Previous by thread: QTKit and NSImage not playing nice
  • Next by thread: Weird behavior after exiting full screen OpenGL application
  • Index(es):
    • Date
    • Thread