Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

< Previous PageNext Page > Hide TOC

Moving Data Out Of Quartz 2D

The functions listed in Table 10-2 move data out of Quartz 2D. All these functions, except for CGPDFContextCreateWithURL, either return an image destination (CGImageDestinationRef) or a data consumer (CGDataConsumerRef). Image destination and data consumers abstract the data-writing task, letting Quartz take care of the details for you. Image destinations are used exclusively for writing image data, but are available only in Mac OS X v10.4 or later. Similar to image sources, an image destination can represent a variety of image data, from a single image to a destination that contains multiple images, thumbnail images, and properties for each image or for the image file.

Data consumers can be used to write image or PDF data, and all, except for CGDataConsumerCreateWithCFData, are available in Mac OS X v10.0 or later. The function CGPDFContextCreateWithURL is a convenience function that writes PDF data to the location specified by a URL.

You can supply a data consumer to:

When you are working with image data and your application runs in Mac OS X v10.4 or later, an image destination is the preferred way to move image data out of Quartz. After you have a CGImageDestinationRef, you can accomplish these tasks:

For more information on images, see “Bitmap Images and Image Masks.”

Table 10-2  Functions that move data out of Quartz 2D

Function

When to use this function

Availability

CGDataConsumerCreateWithURL

Whenever you can supply a URL that specifies where to write the image or PDF data.

10.0

CGDataConsumerCreate

To write image or PDF data using callbacks you supply.

10.0

CGPDFContextCreateWithURL

Whenever you can supply a URL that specifies where to write PDF data.

10.0

CGDataConsumerCreateWithCFData

To write image or PDF data to a CFData object.

10.4

CGImageDestinationCreateWithDataConsumer

To write image data to a data consumer.

10.4

CGImageDestinationCreateWithData

To write image data to a CFData object.

10.4

CGImageDestinationCreateWithURL

Whenever you can supply a URL that specifies where to write the image data.

10.4



< Previous PageNext Page > Hide TOC


Last updated: 2007-12-11




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.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice