diff options
author | Adrian Johnson <ajohnson@redneon.com> | 2011-12-06 20:46:21 +1030 |
---|---|---|
committer | Adrian Johnson <ajohnson@redneon.com> | 2011-12-06 20:46:21 +1030 |
commit | 74c0a06105e3d08b057a770e0545849836f6babb (patch) | |
tree | 70b10ceea620f4ae51377bea5d9152dfb2e69d38 | |
parent | 25e35b46bfd2a71a8cf0484e51351961ad1c82a3 (diff) |
pdf: allow embedding of cmyk jpeg images
-rw-r--r-- | src/cairo-pdf-surface.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c index 5a54530b..f61638cc 100644 --- a/src/cairo-pdf-surface.c +++ b/src/cairo-pdf-surface.c @@ -2330,6 +2330,7 @@ _cairo_pdf_surface_emit_jpeg_image (cairo_pdf_surface_t *surface, const unsigned char *mime_data; unsigned long mime_data_length; cairo_image_info_t info; + const char *colorspace; cairo_surface_get_mime_data (source, CAIRO_MIME_TYPE_JPEG, &mime_data, &mime_data_length); @@ -2342,8 +2343,19 @@ _cairo_pdf_surface_emit_jpeg_image (cairo_pdf_surface_t *surface, if (unlikely (status)) return status; - if (info.num_components != 1 && info.num_components != 3) - return CAIRO_INT_STATUS_UNSUPPORTED; + switch (info.num_components) { + case 1: + colorspace = "/DeviceGray"; + break; + case 3: + colorspace = "/DeviceRGB"; + break; + case 4: + colorspace = "/DeviceCMYK"; + break; + default: + return CAIRO_INT_STATUS_UNSUPPORTED; + } status = _cairo_pdf_surface_open_stream (surface, &res, @@ -2357,7 +2369,7 @@ _cairo_pdf_surface_emit_jpeg_image (cairo_pdf_surface_t *surface, " /Filter /DCTDecode\n", info.width, info.height, - info.num_components == 1 ? "/DeviceGray" : "/DeviceRGB", + colorspace, info.bits_per_component); if (unlikely (status)) return status; |