ADC Home > Reference Library > Technical Q&As > QuickTime > Carbon >

LockPixels and DisposeGWorld with QTNewGWorldFromPtr

Q: When using QTNewGWorldFromPtr I'd like to know when is it necessary to call LockPixels? Additionally, what happens to the pixel data when a GWorld returned by QTNewGWorldFromPtr is disposed?

A: QTNewGWorldFromPtr requires the caller to supply a pointer to a pixel buffer that will be available for the lifetime of the returned GWorld and will not move in memory.

When supplying your own pointer for the buffer parameter (baseAddr), calling LockPixels is not necessary. It is however your responsibility to make sure this pixel buffer is available for the lifetime of the GWorld and that it not move in memory.

When supplying a pointer to some pixel data belonging to another GWorld, it is your responsibility to ensure the source GWorlds pixels are locked. Therefore, you should call LockPixels for the source GWorld's PixMap. This should be done before calling QTNewGWorldFromPtr. Be sure to not unlock or dispose the source GWorld's PixMap until you're done with the GWorld created by calling QTNewGWorldFromPtr.

When a GWorld created by calling QTNewGWorldFromPtr is disposed; its pixel data is not disposed as QuickTime does not know how the pixel data was originally allocated. It is therefore your responsibility to manage disposing of the pixel data.

[Feb 26 2001]

Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.