summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2013-10-31 11:30:29 +0100
committerTor Andersson <tor.andersson@artifex.com>2013-10-31 11:33:17 +0100
commit62e5cd079076cabf3722057416ed743777653a1b (patch)
tree0ebb77ed61b15d9b78ce3f36f9c8773f662c2aa5 /source
parent52dd8a3e321bb965f8f02494026d545fddf54c01 (diff)
downloadmupdf-62e5cd079076cabf3722057416ed743777653a1b.tar.xz
Add CMYK support to PAM output.
Diffstat (limited to 'source')
-rw-r--r--source/fitz/pixmap.c19
-rw-r--r--source/tools/mudraw.c2
2 files changed, 9 insertions, 12 deletions
diff --git a/source/fitz/pixmap.c b/source/fitz/pixmap.c
index 2d8b4c18..e456bd8f 100644
--- a/source/fitz/pixmap.c
+++ b/source/fitz/pixmap.c
@@ -497,7 +497,7 @@ fz_write_pnm(fz_context *ctx, fz_pixmap *pixmap, char *filename)
*/
void
-fz_output_pam_header(fz_output *out, int w, int h, int n, fz_colorspace *cs, int savealpha)
+fz_output_pam_header(fz_output *out, int w, int h, int n, int savealpha)
{
int sn = n;
int dn = n;
@@ -509,15 +509,12 @@ fz_output_pam_header(fz_output *out, int w, int h, int n, fz_colorspace *cs, int
fz_printf(out, "HEIGHT %d\n", h);
fz_printf(out, "DEPTH %d\n", dn);
fz_printf(out, "MAXVAL 255\n");
- if (cs)
- fz_printf(out, "# COLORSPACE %s\n", cs->name);
- switch (dn)
- {
- case 1: fz_printf(out, "TUPLTYPE GRAYSCALE\n"); break;
- case 2: if (sn == 2) fz_printf(out, "TUPLTYPE GRAYSCALE_ALPHA\n"); break;
- case 3: if (sn == 4) fz_printf(out, "TUPLTYPE RGB\n"); break;
- case 4: if (sn == 4) fz_printf(out, "TUPLTYPE RGB_ALPHA\n"); break;
- }
+ if (dn == 1) fz_printf(out, "TUPLTYPE GRAYSCALE\n");
+ else if (dn == 2 && sn == 2) fz_printf(out, "TUPLTYPE GRAYSCALE_ALPHA\n");
+ else if (dn == 3 && sn == 4) fz_printf(out, "TUPLTYPE RGB\n");
+ else if (dn == 4 && sn == 4) fz_printf(out, "TUPLTYPE RGB_ALPHA\n");
+ else if (dn == 4 && sn == 5) fz_printf(out, "TUPLTYPE CMYK\n");
+ else if (dn == 5 && sn == 5) fz_printf(out, "TUPLTYPE CMYK_ALPHA\n");
fz_printf(out, "ENDHDR\n");
}
@@ -552,7 +549,7 @@ void
fz_write_pam(fz_context *ctx, fz_pixmap *pixmap, char *filename, int savealpha)
{
fz_output *out = fz_new_output_to_filename(ctx, filename);
- fz_output_pam_header(out, pixmap->w, pixmap->h, pixmap->n, pixmap->colorspace, savealpha);
+ fz_output_pam_header(out, pixmap->w, pixmap->h, pixmap->n, savealpha);
fz_output_pam_band(out, pixmap->w, pixmap->h, pixmap->n, 0, pixmap->h, pixmap->samples, savealpha);
fz_close_output(out);
}
diff --git a/source/tools/mudraw.c b/source/tools/mudraw.c
index 27f32f99..e6986c63 100644
--- a/source/tools/mudraw.c
+++ b/source/tools/mudraw.c
@@ -687,7 +687,7 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum)
if (output_format == OUT_PGM || output_format == OUT_PPM || output_format == OUT_PNM)
fz_output_pnm_header(output_file, pix->w, totalheight, pix->n);
else if (output_format == OUT_PAM)
- fz_output_pam_header(output_file, pix->w, totalheight, pix->n, pix->colorspace, savealpha);
+ fz_output_pam_header(output_file, pix->w, totalheight, pix->n, savealpha);
else if (output_format == OUT_PNG)
poc = fz_output_png_header(output_file, pix->w, totalheight, pix->n, savealpha);
}