summaryrefslogtreecommitdiff
path: root/source/fitz/output-pcl.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2017-07-12 21:18:45 +0100
committerRobin Watts <robin.watts@artifex.com>2017-07-19 19:41:23 +0100
commitd54763bcd644364c19d3a6a12f889127df583e01 (patch)
tree379843a30fbb263e811ac6cbe3d2a4abe13b6fb3 /source/fitz/output-pcl.c
parentd541fc4b9eced1b788377df8c7edfd9b8dea4094 (diff)
downloadmupdf-d54763bcd644364c19d3a6a12f889127df583e01.tar.xz
Update band writer (especially PSD) to cope with spots
PSD writer now outputs spot colors. Ensure subtractive colorspaces are stored with proper polarity. The CMYK and spot components need to be 255-X in the PSD format Store PSD format resources using correct Pascal style strings. Photoshop will fail to open if the the ICC profile resource name is not in proper format. (Incorporates fixes from Michael).
Diffstat (limited to 'source/fitz/output-pcl.c')
-rw-r--r--source/fitz/output-pcl.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/source/fitz/output-pcl.c b/source/fitz/output-pcl.c
index 7f676cf5..bb3a82dd 100644
--- a/source/fitz/output-pcl.c
+++ b/source/fitz/output-pcl.c
@@ -691,7 +691,7 @@ fz_write_pixmap_as_pcl(fz_context *ctx, fz_output *out, const fz_pixmap *pixmap,
writer = fz_new_color_pcl_band_writer(ctx, out, pcl);
fz_try(ctx)
{
- fz_write_header(ctx, writer, pixmap->w, pixmap->h, pixmap->n, pixmap->alpha, pixmap->xres, pixmap->yres, 0, pixmap->colorspace);
+ fz_write_header(ctx, writer, pixmap->w, pixmap->h, pixmap->n, pixmap->alpha, pixmap->xres, pixmap->yres, 0, pixmap->colorspace, pixmap->seps);
fz_write_band(ctx, writer, pixmap->stride, pixmap->h, pixmap->samples);
}
fz_always(ctx)
@@ -723,7 +723,7 @@ color_pcl_write_header(fz_context *ctx, fz_band_writer *writer_, const fz_colors
int xres = writer->super.xres;
int yres = writer->super.yres;
- if (n != 4)
+ if (n != 4 || writer->super.s != 0)
fz_throw(ctx, FZ_ERROR_GENERIC, "pixmap must be rgb to write as pcl");
writer->linebuf = fz_malloc(ctx, w * 3 * 2);
@@ -1078,7 +1078,7 @@ fz_write_bitmap_as_pcl(fz_context *ctx, fz_output *out, const fz_bitmap *bitmap,
writer = fz_new_mono_pcl_band_writer(ctx, out, pcl);
fz_try(ctx)
{
- fz_write_header(ctx, writer, bitmap->w, bitmap->h, 1, 0, bitmap->xres, bitmap->yres, 0, NULL);
+ fz_write_header(ctx, writer, bitmap->w, bitmap->h, 1, 0, bitmap->xres, bitmap->yres, 0, NULL, NULL);
fz_write_band(ctx, writer, bitmap->stride, bitmap->h, bitmap->samples);
}
fz_always(ctx)
@@ -1111,6 +1111,9 @@ mono_pcl_write_header(fz_context *ctx, fz_band_writer *writer_, const fz_colorsp
int max_mode_2_size;
int max_mode_3_size;
+ if (writer->super.s != 0)
+ fz_throw(ctx, FZ_ERROR_GENERIC, "Mono PCL cannot write spot colors");
+
line_size = (w + 7)/8;
max_mode_2_size = line_size + (line_size/127) + 1;
max_mode_3_size = line_size + (line_size/8) + 1;