ADC Home > Reference Library > Technical Q&As > Graphics & Imaging > Quartz >

How do I use QuickDraw with CGDirectDisplay?

Q: How do I get my QuickDraw graphics onscreen once I've captured the display using CGDirectDisplay?

A: CGDirectDisplay is great for capturing displays, changing resolutions and bit depths, and doing gamma fades. In order to combine that with QuickDraw, you need to use a function from QuickDraw.h, CreateNewPortForCGDisplayID. Take the display ID you've used in CGDirectDisplay and pass it to CreateNewPortForCGDisplayID to create a brand new QuickDraw CGrafPort. Once you've used SetPort to switch to this new port, you can draw using any QuickDraw graphics function but the most likely use will be to call CopyBits to move graphics from an offscreen GWorld to the screen. Don't forget to use GetPortBitMapForCopyBits and definitely don't forget to call DisposePort on the new port once you are finished with it.

[Apr 11 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.