/* image destination -> data consumer -> job's gvdevice */
/* data provider <- job's imagedata */
CGDataConsumerRef data_consumer = CGDataConsumerCreate(job, &device_data_consumer_callbacks);
- CGImageDestinationRef image_destination = CGImageDestinationCreateWithDataConsumer(data_consumer, format_uti[job->device.id], 1, NULL);
+ CGImageDestinationRef image_destination = CGImageDestinationCreateWithDataConsumer(data_consumer, format_to_uti(job->device.id), 1, NULL);
CGDataProviderRef data_provider = CGDataProviderCreateDirect(job->imagedata, BYTES_PER_PIXEL * job->width * job->height, &memory_data_provider_callbacks);
/* add the bitmap image to the destination and save it */
CFDictionaryRef options = hint_format_type == FORMAT_NONE ? NULL : CFDictionaryCreate(
kCFAllocatorDefault,
(const void **)&kCGImageSourceTypeIdentifierHint,
- (const void **)(format_uti + hint_format_type),
+ (const void **)format_to_uti(hint_format_type),
1,
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1040
extern gvplugin_installed_t gvdevice_quartz_types_for_cairo;
-
-/* Uniform Type Identifiers corresponding to each format_type */
-CFStringRef format_uti [] = {
- NULL,
- NULL,
- CFSTR("com.microsoft.bmp"),
- CFSTR("com.ilm.openexr-image"),
- CFSTR("com.compuserve.gif"),
- CFSTR("public.jpeg"),
- CFSTR("public.jpeg-2000"),
- CFSTR("com.adobe.pdf"),
- CFSTR("com.apple.pict"),
- CFSTR("public.png"),
- CFSTR("com.adobe.photoshop-image"),
- CFSTR("com.sgi.sgi-image"),
- CFSTR("public.tiff"),
- CFSTR("com.truevision.tga-image")
-};
-
#endif
/* data consumer backed by the gvdevice */
NULL
};
+#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1040
+
+CFStringRef format_to_uti(format_type format)
+{
+ switch (format) {
+ case FORMAT_BMP:
+ return CFSTR("com.microsoft.bmp");
+ case FORMAT_EXR:
+ return CFSTR("com.ilm.openexr-image");
+ case FORMAT_GIF:
+ return CFSTR("com.compuserve.gif");
+ case FORMAT_JPEG:
+ return CFSTR("public.jpeg");
+ case FORMAT_JPEG2000:
+ return CFSTR("public.jpeg-2000");
+ case FORMAT_PICT:
+ return CFSTR("com.apple.pict");
+ case FORMAT_PNG:
+ return CFSTR("public.png");
+ case FORMAT_PSD:
+ return CFSTR("com.adobe.photoshop-image");
+ case FORMAT_SGI:
+ return CFSTR("com.sgi.sgi-image");
+ case FORMAT_TIFF:
+ return CFSTR("public.tiff");
+ case FORMAT_TGA:
+ return CFSTR("com.truevision.tga-image");
+ default:
+ return NULL;
+ }
+}
+
+#endif
+
static gvplugin_api_t apis[] = {
{API_render, &gvrender_quartz_types},
{API_textlayout, &gvtextlayout_quartz_types},